1190118d0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3190118d0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4190118d0SAndrew Rist * or more contributor license agreements. See the NOTICE file
5190118d0SAndrew Rist * distributed with this work for additional information
6190118d0SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7190118d0SAndrew Rist * to you under the Apache License, Version 2.0 (the
8190118d0SAndrew Rist * "License"); you may not use this file except in compliance
9190118d0SAndrew Rist * with the License. You may obtain a copy of the License at
10190118d0SAndrew Rist *
11190118d0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12190118d0SAndrew Rist *
13190118d0SAndrew Rist * Unless required by applicable law or agreed to in writing,
14190118d0SAndrew Rist * software distributed under the License is distributed on an
15190118d0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16190118d0SAndrew Rist * KIND, either express or implied. See the License for the
17190118d0SAndrew Rist * specific language governing permissions and limitations
18190118d0SAndrew Rist * under the License.
19190118d0SAndrew Rist *
20190118d0SAndrew Rist *************************************************************/
21190118d0SAndrew Rist
22190118d0SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_editeng.hxx"
26cdf0e10cSrcweir #include <tools/debug.hxx>
27cdf0e10cSrcweir
28cdf0e10cSrcweir #include <editeng/unoedhlp.hxx>
29cdf0e10cSrcweir #include <editeng/editdata.hxx>
30cdf0e10cSrcweir #include <editeng/editeng.hxx>
319b8096d0SSteve Yin #include <svl/itemset.hxx>
32cdf0e10cSrcweir
33cdf0e10cSrcweir //------------------------------------------------------------------------
34cdf0e10cSrcweir
35cdf0e10cSrcweir TYPEINIT1( SvxEditSourceHint, TextHint );
36cdf0e10cSrcweir
SvxEditSourceHint(sal_uLong _nId)37cdf0e10cSrcweir SvxEditSourceHint::SvxEditSourceHint( sal_uLong _nId ) :
38cdf0e10cSrcweir TextHint( _nId ),
39cdf0e10cSrcweir mnStart( 0 ),
40cdf0e10cSrcweir mnEnd( 0 )
41cdf0e10cSrcweir {
42cdf0e10cSrcweir }
43cdf0e10cSrcweir
SvxEditSourceHint(sal_uLong _nId,sal_uLong nValue,sal_uLong nStart,sal_uLong nEnd)44cdf0e10cSrcweir SvxEditSourceHint::SvxEditSourceHint( sal_uLong _nId, sal_uLong nValue, sal_uLong nStart, sal_uLong nEnd ) :
45cdf0e10cSrcweir TextHint( _nId, nValue ),
46cdf0e10cSrcweir mnStart( nStart),
47cdf0e10cSrcweir mnEnd( nEnd )
48cdf0e10cSrcweir {
49cdf0e10cSrcweir }
50cdf0e10cSrcweir
GetValue() const51cdf0e10cSrcweir sal_uLong SvxEditSourceHint::GetValue() const
52cdf0e10cSrcweir {
53cdf0e10cSrcweir return TextHint::GetValue();
54cdf0e10cSrcweir }
55cdf0e10cSrcweir
GetStartValue() const56cdf0e10cSrcweir sal_uLong SvxEditSourceHint::GetStartValue() const
57cdf0e10cSrcweir {
58cdf0e10cSrcweir return mnStart;
59cdf0e10cSrcweir }
60cdf0e10cSrcweir
GetEndValue() const61cdf0e10cSrcweir sal_uLong SvxEditSourceHint::GetEndValue() const
62cdf0e10cSrcweir {
63cdf0e10cSrcweir return mnEnd;
64cdf0e10cSrcweir }
65cdf0e10cSrcweir
SetValue(sal_uLong n)66cdf0e10cSrcweir void SvxEditSourceHint::SetValue( sal_uLong n )
67cdf0e10cSrcweir {
68cdf0e10cSrcweir TextHint::SetValue( n );
69cdf0e10cSrcweir }
70cdf0e10cSrcweir
SetStartValue(sal_uLong n)71cdf0e10cSrcweir void SvxEditSourceHint::SetStartValue( sal_uLong n )
72cdf0e10cSrcweir {
73cdf0e10cSrcweir mnStart = n;
74cdf0e10cSrcweir }
75cdf0e10cSrcweir
SetEndValue(sal_uLong n)76cdf0e10cSrcweir void SvxEditSourceHint::SetEndValue( sal_uLong n )
77cdf0e10cSrcweir {
78cdf0e10cSrcweir mnEnd = n;
79cdf0e10cSrcweir }
809b8096d0SSteve Yin TYPEINIT1( SvxEditSourceHintEndPara , SvxEditSourceHint );
81cdf0e10cSrcweir //------------------------------------------------------------------------
82cdf0e10cSrcweir
EENotification2Hint(EENotify * aNotify)83cdf0e10cSrcweir ::std::auto_ptr<SfxHint> SvxEditSourceHelper::EENotification2Hint( EENotify* aNotify )
84cdf0e10cSrcweir {
85cdf0e10cSrcweir if( aNotify )
86cdf0e10cSrcweir {
87cdf0e10cSrcweir switch( aNotify->eNotificationType )
88cdf0e10cSrcweir {
89cdf0e10cSrcweir case EE_NOTIFY_TEXTMODIFIED:
90cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_MODIFIED, aNotify->nParagraph ) );
91cdf0e10cSrcweir
92cdf0e10cSrcweir case EE_NOTIFY_PARAGRAPHINSERTED:
93cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_PARAINSERTED, aNotify->nParagraph ) );
94cdf0e10cSrcweir
95cdf0e10cSrcweir case EE_NOTIFY_PARAGRAPHREMOVED:
96cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_PARAREMOVED, aNotify->nParagraph ) );
97cdf0e10cSrcweir
98cdf0e10cSrcweir case EE_NOTIFY_PARAGRAPHSMOVED:
99cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new SvxEditSourceHint( EDITSOURCE_HINT_PARASMOVED, aNotify->nParagraph, aNotify->nParam1, aNotify->nParam2 ) );
100cdf0e10cSrcweir
101cdf0e10cSrcweir case EE_NOTIFY_TEXTHEIGHTCHANGED:
102cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_TEXTHEIGHTCHANGED, aNotify->nParagraph ) );
103cdf0e10cSrcweir
104cdf0e10cSrcweir case EE_NOTIFY_TEXTVIEWSCROLLED:
105cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_VIEWSCROLLED ) );
106cdf0e10cSrcweir
107cdf0e10cSrcweir case EE_NOTIFY_TEXTVIEWSELECTIONCHANGED:
108cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new SvxEditSourceHint( EDITSOURCE_HINT_SELECTIONCHANGED ) );
109cdf0e10cSrcweir
110cdf0e10cSrcweir case EE_NOTIFY_BLOCKNOTIFICATION_START:
111cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_BLOCKNOTIFICATION_START, 0 ) );
112cdf0e10cSrcweir
113cdf0e10cSrcweir case EE_NOTIFY_BLOCKNOTIFICATION_END:
114cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_BLOCKNOTIFICATION_END, 0 ) );
115cdf0e10cSrcweir
116cdf0e10cSrcweir case EE_NOTIFY_INPUT_START:
117cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_INPUT_START, 0 ) );
118cdf0e10cSrcweir
119cdf0e10cSrcweir case EE_NOTIFY_INPUT_END:
120cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_INPUT_END, 0 ) );
1219b8096d0SSteve Yin case EE_NOTIFY_TEXTVIEWSELECTIONCHANGED_ENDD_PARA:
1229b8096d0SSteve Yin return ::std::auto_ptr<SfxHint>( new SvxEditSourceHintEndPara( EDITSOURCE_HINT_SELECTIONCHANGED ) );
123cdf0e10cSrcweir default:
124cdf0e10cSrcweir DBG_ERROR( "SvxEditSourceHelper::EENotification2Hint unknown notification" );
125cdf0e10cSrcweir break;
126cdf0e10cSrcweir }
127cdf0e10cSrcweir }
128cdf0e10cSrcweir
129cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new SfxHint() );
130cdf0e10cSrcweir }
GetAttributeRun(sal_uInt16 & nStartIndex,sal_uInt16 & nEndIndex,const EditEngine & rEE,sal_uInt32 nPara,sal_uInt16 nIndex,sal_Bool bInCell)131*7a980842SDamjanJovanovic sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_uInt32 nPara, sal_uInt16 nIndex, sal_Bool bInCell )
132cdf0e10cSrcweir {
1339b8096d0SSteve Yin // IA2 CWS introduced bInCell, but also did many other changes here.
1349b8096d0SSteve Yin // Need to verify implementation with AT (IA2 and ATK)
1359b8096d0SSteve Yin // Old implementation at the end of the method for reference...
1369b8096d0SSteve Yin
1374d7c9de0SHerbert Dürr #if 1
1389b8096d0SSteve Yin //added dummy attributes for the default text
1399b8096d0SSteve Yin EECharAttribArray aCharAttribs, aTempCharAttribs;
1409b8096d0SSteve Yin rEE.GetCharAttribs( nPara, aTempCharAttribs );
1419b8096d0SSteve Yin if ( aTempCharAttribs.Count() )
1429b8096d0SSteve Yin {
1439b8096d0SSteve Yin sal_uInt32 nIndex2 = 0;
1449b8096d0SSteve Yin sal_uInt32 nParaLen = rEE.GetTextLen(nPara);
1459b8096d0SSteve Yin for ( sal_uInt16 nAttr = 0; nAttr < aTempCharAttribs.Count(); nAttr++ )
1469b8096d0SSteve Yin {
1479b8096d0SSteve Yin if ( nIndex2 < aTempCharAttribs[nAttr].nStart )
1489b8096d0SSteve Yin {
1499b8096d0SSteve Yin EECharAttrib aEEAttr;
1509b8096d0SSteve Yin aEEAttr.nStart = sal_uInt16(nIndex2);
1519b8096d0SSteve Yin aEEAttr.nEnd = aTempCharAttribs[nAttr].nStart;
1529b8096d0SSteve Yin aCharAttribs.Insert( aEEAttr, nAttr );
1539b8096d0SSteve Yin }
1549b8096d0SSteve Yin nIndex2 = aTempCharAttribs[nAttr].nEnd;
1559b8096d0SSteve Yin aCharAttribs.Insert( aTempCharAttribs[nAttr], aCharAttribs.Count() );
1569b8096d0SSteve Yin }
1579b8096d0SSteve Yin if ( nIndex2 != nParaLen )
1589b8096d0SSteve Yin {
1599b8096d0SSteve Yin EECharAttrib aEEAttr;
1609b8096d0SSteve Yin aEEAttr.nStart = sal_uInt16(nIndex2);
1619b8096d0SSteve Yin aEEAttr.nEnd = sal_uInt16(nParaLen);
1629b8096d0SSteve Yin aCharAttribs.Insert( aEEAttr, aCharAttribs.Count() );
1639b8096d0SSteve Yin }
1649b8096d0SSteve Yin }
1659b8096d0SSteve Yin // find closest index in front of nIndex
1669b8096d0SSteve Yin sal_uInt16 nAttr, nCurrIndex;
1679b8096d0SSteve Yin sal_Int32 nClosestStartIndex;
1689b8096d0SSteve Yin sal_Int32 nClosestStartIndex_s, nClosestStartIndex_e;
1699b8096d0SSteve Yin for( nAttr=0, nClosestStartIndex_s=0, nClosestStartIndex_e=0; nAttr<aCharAttribs.Count(); ++nAttr )
1709b8096d0SSteve Yin {
1719b8096d0SSteve Yin nCurrIndex = aCharAttribs[nAttr].nStart;
1729b8096d0SSteve Yin
1739b8096d0SSteve Yin //if( nCurrIndex > nIndex )
1749b8096d0SSteve Yin // break; // aCharAttribs array is sorted in increasing order for nStart values
1759b8096d0SSteve Yin
1769b8096d0SSteve Yin if( nCurrIndex > nClosestStartIndex_s &&
1779b8096d0SSteve Yin nCurrIndex <= nIndex)
1789b8096d0SSteve Yin {
1799b8096d0SSteve Yin nClosestStartIndex_s = nCurrIndex;
1809b8096d0SSteve Yin }
1819b8096d0SSteve Yin nCurrIndex = aCharAttribs[nAttr].nEnd;
1829b8096d0SSteve Yin if ( nCurrIndex > nClosestStartIndex_e &&
1839b8096d0SSteve Yin nCurrIndex < nIndex )
1849b8096d0SSteve Yin {
1859b8096d0SSteve Yin nClosestStartIndex_e = nCurrIndex;
1869b8096d0SSteve Yin }
1879b8096d0SSteve Yin }
1889b8096d0SSteve Yin nClosestStartIndex = nClosestStartIndex_s > nClosestStartIndex_e ? nClosestStartIndex_s : nClosestStartIndex_e;
1899b8096d0SSteve Yin
1909b8096d0SSteve Yin // find closest index behind of nIndex
1919b8096d0SSteve Yin sal_Int32 nClosestEndIndex;
1929b8096d0SSteve Yin sal_Int32 nClosestEndIndex_s, nClosestEndIndex_e;
1939b8096d0SSteve Yin for( nAttr=0, nClosestEndIndex_s=nClosestEndIndex_e=rEE.GetTextLen(nPara); nAttr<aCharAttribs.Count(); ++nAttr )
1949b8096d0SSteve Yin {
1959b8096d0SSteve Yin nCurrIndex = aCharAttribs[nAttr].nEnd;
1969b8096d0SSteve Yin
1979b8096d0SSteve Yin if( nCurrIndex > nIndex &&
1989b8096d0SSteve Yin nCurrIndex < nClosestEndIndex_e )
1999b8096d0SSteve Yin {
2009b8096d0SSteve Yin nClosestEndIndex_e = nCurrIndex;
2019b8096d0SSteve Yin }
2029b8096d0SSteve Yin nCurrIndex = aCharAttribs[nAttr].nStart;
2039b8096d0SSteve Yin if ( nCurrIndex > nIndex &&
2049b8096d0SSteve Yin nCurrIndex < nClosestEndIndex_s)
2059b8096d0SSteve Yin {
2069b8096d0SSteve Yin nClosestEndIndex_s = nCurrIndex;
2079b8096d0SSteve Yin }
2089b8096d0SSteve Yin }
2099b8096d0SSteve Yin nClosestEndIndex = nClosestEndIndex_s < nClosestEndIndex_e ? nClosestEndIndex_s : nClosestEndIndex_e;
2109b8096d0SSteve Yin
2119b8096d0SSteve Yin nStartIndex = static_cast<sal_uInt16>( nClosestStartIndex );
2129b8096d0SSteve Yin nEndIndex = static_cast<sal_uInt16>( nClosestEndIndex );
2139b8096d0SSteve Yin if ( bInCell )
2149b8096d0SSteve Yin {
2159b8096d0SSteve Yin EPosition aStartPos( nPara, nStartIndex ), aEndPos( nPara, nEndIndex );
2169b8096d0SSteve Yin sal_uInt32 nParaCount = rEE.GetParagraphCount();
2179b8096d0SSteve Yin sal_uInt32 nCrrntParaLen = rEE.GetTextLen(nPara);
2189b8096d0SSteve Yin //need to find closest index in front of nIndex in the previous paragraphs
2199b8096d0SSteve Yin if ( aStartPos.nIndex == 0 )
2209b8096d0SSteve Yin {
2219b8096d0SSteve Yin SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, 0, 1, GETATTRIBS_CHARATTRIBS );
2229b8096d0SSteve Yin for ( sal_Int32 nParaIdx = nPara-1; nParaIdx >= 0; nParaIdx-- )
2239b8096d0SSteve Yin {
224*7a980842SDamjanJovanovic sal_uInt32 nLen = rEE.GetTextLen( nParaIdx );
2259b8096d0SSteve Yin if ( nLen )
2269b8096d0SSteve Yin {
2279b8096d0SSteve Yin sal_uInt16 nStartIdx, nEndIdx;
228*7a980842SDamjanJovanovic GetAttributeRun( nStartIdx, nEndIdx, rEE, nParaIdx, sal_uInt16(nLen), sal_False );
229*7a980842SDamjanJovanovic SfxItemSet aSet = rEE.GetAttribs( nParaIdx, sal_uInt16(nLen-1), sal_uInt16(nLen), GETATTRIBS_CHARATTRIBS );
2309b8096d0SSteve Yin if ( aSet == aCrrntSet )
2319b8096d0SSteve Yin {
232*7a980842SDamjanJovanovic aStartPos.nPara = nParaIdx;
2339b8096d0SSteve Yin aStartPos.nIndex = nStartIdx;
2349b8096d0SSteve Yin if ( aStartPos.nIndex != 0 )
2359b8096d0SSteve Yin {
2369b8096d0SSteve Yin break;
2379b8096d0SSteve Yin }
2389b8096d0SSteve Yin }
2399b8096d0SSteve Yin }
2409b8096d0SSteve Yin }
2419b8096d0SSteve Yin }
2429b8096d0SSteve Yin //need find closest index behind nIndex in the following paragrphs
2439b8096d0SSteve Yin if ( aEndPos.nIndex == nCrrntParaLen )
2449b8096d0SSteve Yin {
2459b8096d0SSteve Yin SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, sal_uInt16(nCrrntParaLen-1), sal_uInt16(nCrrntParaLen), GETATTRIBS_CHARATTRIBS );
2469b8096d0SSteve Yin for ( sal_uInt32 nParaIdx = nPara+1; nParaIdx < nParaCount; nParaIdx++ )
2479b8096d0SSteve Yin {
248*7a980842SDamjanJovanovic sal_uInt32 nLen = rEE.GetTextLen( nParaIdx );
2499b8096d0SSteve Yin if ( nLen )
2509b8096d0SSteve Yin {
2519b8096d0SSteve Yin sal_uInt16 nStartIdx, nEndIdx;
252*7a980842SDamjanJovanovic GetAttributeRun( nStartIdx, nEndIdx, rEE, nParaIdx, 0, sal_False );
253*7a980842SDamjanJovanovic SfxItemSet aSet = rEE.GetAttribs( nParaIdx, 0, 1, GETATTRIBS_CHARATTRIBS );
2549b8096d0SSteve Yin if ( aSet == aCrrntSet )
2559b8096d0SSteve Yin {
256*7a980842SDamjanJovanovic aEndPos.nPara = nParaIdx;
2579b8096d0SSteve Yin aEndPos.nIndex = nEndIdx;
2589b8096d0SSteve Yin if ( aEndPos.nIndex != nLen )
2599b8096d0SSteve Yin {
2609b8096d0SSteve Yin break;
2619b8096d0SSteve Yin }
2629b8096d0SSteve Yin }
2639b8096d0SSteve Yin }
2649b8096d0SSteve Yin }
2659b8096d0SSteve Yin }
2669b8096d0SSteve Yin nStartIndex = 0;
2679b8096d0SSteve Yin if ( aStartPos.nPara > 0 )
2689b8096d0SSteve Yin {
269*7a980842SDamjanJovanovic for ( sal_uInt32 i = 0; i < aStartPos.nPara; i++ )
2709b8096d0SSteve Yin {
2719b8096d0SSteve Yin nStartIndex += rEE.GetTextLen(i)+1;
2729b8096d0SSteve Yin }
2739b8096d0SSteve Yin }
2749b8096d0SSteve Yin nStartIndex += aStartPos.nIndex;
2759b8096d0SSteve Yin nEndIndex = 0;
2769b8096d0SSteve Yin if ( aEndPos.nPara > 0 )
2779b8096d0SSteve Yin {
278*7a980842SDamjanJovanovic for ( sal_uInt32 i = 0; i < aEndPos.nPara; i++ )
2799b8096d0SSteve Yin {
2809b8096d0SSteve Yin nEndIndex += rEE.GetTextLen(i)+1;
2819b8096d0SSteve Yin }
2829b8096d0SSteve Yin }
2839b8096d0SSteve Yin nEndIndex += aEndPos.nIndex;
2849b8096d0SSteve Yin }
2859b8096d0SSteve Yin
2869b8096d0SSteve Yin return sal_True;
2879b8096d0SSteve Yin
2889b8096d0SSteve Yin #else // old implementation
2899b8096d0SSteve Yin
290cdf0e10cSrcweir EECharAttribArray aCharAttribs;
291cdf0e10cSrcweir
292cdf0e10cSrcweir rEE.GetCharAttribs( nPara, aCharAttribs );
293cdf0e10cSrcweir
294cdf0e10cSrcweir // find closest index in front of nIndex
295cdf0e10cSrcweir sal_uInt16 nAttr, nCurrIndex;
296cdf0e10cSrcweir sal_Int32 nClosestStartIndex;
297cdf0e10cSrcweir for( nAttr=0, nClosestStartIndex=0; nAttr<aCharAttribs.Count(); ++nAttr )
298cdf0e10cSrcweir {
299cdf0e10cSrcweir nCurrIndex = aCharAttribs[nAttr].nStart;
300cdf0e10cSrcweir
301cdf0e10cSrcweir if( nCurrIndex > nIndex )
302cdf0e10cSrcweir break; // aCharAttribs array is sorted in increasing order for nStart values
303cdf0e10cSrcweir
304cdf0e10cSrcweir if( nCurrIndex > nClosestStartIndex )
305cdf0e10cSrcweir {
306cdf0e10cSrcweir nClosestStartIndex = nCurrIndex;
307cdf0e10cSrcweir }
308cdf0e10cSrcweir }
309cdf0e10cSrcweir
310cdf0e10cSrcweir // find closest index behind of nIndex
311cdf0e10cSrcweir sal_Int32 nClosestEndIndex;
312cdf0e10cSrcweir for( nAttr=0, nClosestEndIndex=rEE.GetTextLen(nPara); nAttr<aCharAttribs.Count(); ++nAttr )
313cdf0e10cSrcweir {
314cdf0e10cSrcweir nCurrIndex = aCharAttribs[nAttr].nEnd;
315cdf0e10cSrcweir
316cdf0e10cSrcweir if( nCurrIndex > nIndex &&
317cdf0e10cSrcweir nCurrIndex < nClosestEndIndex )
318cdf0e10cSrcweir {
319cdf0e10cSrcweir nClosestEndIndex = nCurrIndex;
320cdf0e10cSrcweir }
321cdf0e10cSrcweir }
322cdf0e10cSrcweir
323cdf0e10cSrcweir nStartIndex = static_cast<sal_uInt16>( nClosestStartIndex );
324cdf0e10cSrcweir nEndIndex = static_cast<sal_uInt16>( nClosestEndIndex );
325cdf0e10cSrcweir
326cdf0e10cSrcweir return sal_True;
3279b8096d0SSteve Yin
3289b8096d0SSteve Yin #endif
329cdf0e10cSrcweir }
330cdf0e10cSrcweir
EEToUserSpace(const Point & rPoint,const Size & rEESize,bool bIsVertical)331cdf0e10cSrcweir Point SvxEditSourceHelper::EEToUserSpace( const Point& rPoint, const Size& rEESize, bool bIsVertical )
332cdf0e10cSrcweir {
333cdf0e10cSrcweir return bIsVertical ? Point( -rPoint.Y() + rEESize.Height(), rPoint.X() ) : rPoint;
334cdf0e10cSrcweir }
335cdf0e10cSrcweir
UserSpaceToEE(const Point & rPoint,const Size & rEESize,bool bIsVertical)336cdf0e10cSrcweir Point SvxEditSourceHelper::UserSpaceToEE( const Point& rPoint, const Size& rEESize, bool bIsVertical )
337cdf0e10cSrcweir {
338cdf0e10cSrcweir return bIsVertical ? Point( rPoint.Y(), -rPoint.X() + rEESize.Height() ) : rPoint;
339cdf0e10cSrcweir }
340cdf0e10cSrcweir
EEToUserSpace(const Rectangle & rRect,const Size & rEESize,bool bIsVertical)341cdf0e10cSrcweir Rectangle SvxEditSourceHelper::EEToUserSpace( const Rectangle& rRect, const Size& rEESize, bool bIsVertical )
342cdf0e10cSrcweir {
343cdf0e10cSrcweir // #106775# Don't touch rect if not vertical
344cdf0e10cSrcweir return bIsVertical ? Rectangle( EEToUserSpace(rRect.BottomLeft(), rEESize, bIsVertical),
345cdf0e10cSrcweir EEToUserSpace(rRect.TopRight(), rEESize, bIsVertical) ) : rRect;
346cdf0e10cSrcweir }
347cdf0e10cSrcweir
UserSpaceToEE(const Rectangle & rRect,const Size & rEESize,bool bIsVertical)348cdf0e10cSrcweir Rectangle SvxEditSourceHelper::UserSpaceToEE( const Rectangle& rRect, const Size& rEESize, bool bIsVertical )
349cdf0e10cSrcweir {
350cdf0e10cSrcweir // #106775# Don't touch rect if not vertical
351cdf0e10cSrcweir return bIsVertical ? Rectangle( UserSpaceToEE(rRect.TopRight(), rEESize, bIsVertical),
352cdf0e10cSrcweir UserSpaceToEE(rRect.BottomLeft(), rEESize, bIsVertical) ) : rRect;
353cdf0e10cSrcweir }
354