LibreOffice Module editeng (master) 1
unoedprx.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
21// Global header
22
23
24#include <utility>
25#include <memory>
26#include <vector>
27#include <algorithm>
28#include <osl/diagnose.h>
29#include <svl/itemset.hxx>
30#include <tools/debug.hxx>
31
32
33// Project-local header
34
35
36#include <editeng/unoedprx.hxx>
37#include <editeng/editdata.hxx>
38#include <editeng/editeng.hxx>
40#include <editeng/outliner.hxx>
41
42using namespace ::com::sun::star;
43
44namespace {
45
46class SvxAccessibleTextIndex
47{
48public:
49 SvxAccessibleTextIndex() :
50 mnPara(0),
51 mnIndex(0),
52 mnEEIndex(0),
53 mnFieldOffset(0),
54 mnFieldLen(0),
55 mnBulletOffset(0),
56 mnBulletLen(0),
57 mbInField(false),
58 mbInBullet(false) {};
59
60 // Get/Set current paragraph
61 void SetParagraph( sal_Int32 nPara )
62 {
63 mnPara = nPara;
64 }
65 sal_Int32 GetParagraph() const { return mnPara; }
66
75 void SetIndex( sal_Int32 nIndex, const SvxTextForwarder& rTF );
76 void SetIndex( sal_Int32 nPara, sal_Int32 nIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetIndex(nIndex, rTF); }
77 sal_Int32 GetIndex() const { return mnIndex; }
78
90 void SetEEIndex( sal_Int32 nEEIndex, const SvxTextForwarder& rTF );
91 void SetEEIndex( sal_Int32 nPara, sal_Int32 nEEIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetEEIndex(nEEIndex, rTF); }
92 sal_Int32 GetEEIndex() const;
93
94 void SetFieldOffset( sal_Int32 nOffset, sal_Int32 nLen ) { mnFieldOffset = nOffset; mnFieldLen = nLen; }
95 sal_Int32 GetFieldOffset() const { return mnFieldOffset; }
96 sal_Int32 GetFieldLen() const { return mnFieldLen; }
97 void AreInField() { mbInField = true; }
98 bool InField() const { return mbInField; }
99
100 void SetBulletOffset( sal_Int32 nOffset, sal_Int32 nLen ) { mnBulletOffset = nOffset; mnBulletLen = nLen; }
101 sal_Int32 GetBulletOffset() const { return mnBulletOffset; }
102 sal_Int32 GetBulletLen() const { return mnBulletLen; }
103 bool InBullet() const { return mbInBullet; }
104
106 bool IsEditableRange( const SvxAccessibleTextIndex& rEnd ) const;
107
108private:
109 sal_Int32 mnPara;
110 sal_Int32 mnIndex;
111 sal_Int32 mnEEIndex;
112 sal_Int32 mnFieldOffset;
113 sal_Int32 mnFieldLen;
114 sal_Int32 mnBulletOffset;
115 sal_Int32 mnBulletLen;
116 bool mbInField;
117 bool mbInBullet;
118};
119
120}
121
122static ESelection MakeEESelection( const SvxAccessibleTextIndex& rStart, const SvxAccessibleTextIndex& rEnd )
123{
124 // deal with field special case: to really get a field contained
125 // within a selection, the start index must be before or on the
126 // field, the end index after it.
127
128 // The SvxAccessibleTextIndex.GetEEIndex method gives the index on
129 // the field, as long the input index is on the field. Thus,
130 // correction necessary for the end index
131
132 // Therefore, for _ranges_, if part of the field is touched, all
133 // of the field must be selected
134 if( rStart.GetParagraph() <= rEnd.GetParagraph() ||
135 (rStart.GetParagraph() == rEnd.GetParagraph() &&
136 rStart.GetEEIndex() <= rEnd.GetEEIndex()) )
137 {
138 if( rEnd.InField() && rEnd.GetFieldOffset() )
139 return ESelection( rStart.GetParagraph(), rStart.GetEEIndex(),
140 rEnd.GetParagraph(), rEnd.GetEEIndex()+1 );
141 }
142 else if( rStart.GetParagraph() > rEnd.GetParagraph() ||
143 (rStart.GetParagraph() == rEnd.GetParagraph() &&
144 rStart.GetEEIndex() > rEnd.GetEEIndex()) )
145 {
146 if( rStart.InField() && rStart.GetFieldOffset() )
147 return ESelection( rStart.GetParagraph(), rStart.GetEEIndex()+1,
148 rEnd.GetParagraph(), rEnd.GetEEIndex() );
149 }
150
151 return ESelection( rStart.GetParagraph(), rStart.GetEEIndex(),
152 rEnd.GetParagraph(), rEnd.GetEEIndex() );
153}
154
155static ESelection MakeEESelection( const SvxAccessibleTextIndex& rIndex )
156{
157 return ESelection( rIndex.GetParagraph(), rIndex.GetEEIndex(),
158 rIndex.GetParagraph(), rIndex.GetEEIndex() + 1 );
159}
160
161sal_Int32 SvxAccessibleTextIndex::GetEEIndex() const
162{
163 DBG_ASSERT(mnEEIndex >= 0,
164 "SvxAccessibleTextIndex::GetEEIndex: index value overflow");
165
166 return mnEEIndex;
167}
168
169void SvxAccessibleTextIndex::SetEEIndex( sal_Int32 nEEIndex, const SvxTextForwarder& rTF )
170{
171 // reset
172 mnFieldOffset = 0;
173 mbInField = false;
174 mnFieldLen = 0;
175 mnBulletOffset = 0;
176 mbInBullet = false;
177 mnBulletLen = 0;
178
179 // set known values
180 mnEEIndex = nEEIndex;
181
182 // calculate unknowns
183 sal_Int32 nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() );
184
185 mnIndex = nEEIndex;
186
187 EBulletInfo aBulletInfo = rTF.GetBulletInfo( GetParagraph() );
188
189 // any text bullets?
190 if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
191 aBulletInfo.bVisible &&
192 aBulletInfo.nType != SVX_NUM_BITMAP )
193 {
194 mnIndex += aBulletInfo.aText.getLength();
195 }
196
197 for( nCurrField=0; nCurrField < nFieldCount; ++nCurrField )
198 {
199 EFieldInfo aFieldInfo( rTF.GetFieldInfo( GetParagraph(), nCurrField ) );
200
201 if( aFieldInfo.aPosition.nIndex > nEEIndex )
202 break;
203
204 if( aFieldInfo.aPosition.nIndex == nEEIndex )
205 {
206 AreInField();
207 break;
208 }
209
210 mnIndex += std::max(aFieldInfo.aCurrentText.getLength()-1, sal_Int32(0));
211 }
212}
213
214void SvxAccessibleTextIndex::SetIndex( sal_Int32 nIndex, const SvxTextForwarder& rTF )
215{
216 // reset
217 mnFieldOffset = 0;
218 mbInField = false;
219 mnFieldLen = 0;
220 mnBulletOffset = 0;
221 mbInBullet = false;
222 mnBulletLen = 0;
223
224 // set known values
225 mnIndex = nIndex;
226
227 // calculate unknowns
228 sal_Int32 nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() );
229
230 DBG_ASSERT(nIndex >= 0,
231 "SvxAccessibleTextIndex::SetIndex: index value overflow");
232
233 mnEEIndex = nIndex;
234
235 EBulletInfo aBulletInfo = rTF.GetBulletInfo( GetParagraph() );
236
237 // any text bullets?
238 if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
239 aBulletInfo.bVisible &&
240 aBulletInfo.nType != SVX_NUM_BITMAP )
241 {
242 sal_Int32 nBulletLen = aBulletInfo.aText.getLength();
243
244 if( nIndex < nBulletLen )
245 {
246 mbInBullet = true;
247 SetBulletOffset( nIndex, nBulletLen );
248 mnEEIndex = 0;
249 return;
250 }
251
252 mnEEIndex = mnEEIndex - nBulletLen;
253 }
254
255 for( nCurrField=0; nCurrField < nFieldCount; ++nCurrField )
256 {
257 EFieldInfo aFieldInfo( rTF.GetFieldInfo( GetParagraph(), nCurrField ) );
258
259 // we're before a field
260 if( aFieldInfo.aPosition.nIndex > mnEEIndex )
261 break;
262
263 mnEEIndex -= std::max(aFieldInfo.aCurrentText.getLength()-1, sal_Int32(0));
264
265 // we're within a field
266 if( aFieldInfo.aPosition.nIndex >= mnEEIndex )
267 {
268 AreInField();
269 SetFieldOffset( std::max(aFieldInfo.aCurrentText.getLength()-1, sal_Int32(0)) - (aFieldInfo.aPosition.nIndex - mnEEIndex),
270 aFieldInfo.aCurrentText.getLength() );
271 mnEEIndex = aFieldInfo.aPosition.nIndex ;
272 break;
273 }
274 }
275}
276
277bool SvxAccessibleTextIndex::IsEditableRange( const SvxAccessibleTextIndex& rEnd ) const
278{
279 if( GetIndex() > rEnd.GetIndex() )
280 return rEnd.IsEditableRange( *this );
281
282 if( InBullet() || rEnd.InBullet() )
283 return false;
284
285 if( InField() && GetFieldOffset() )
286 return false; // within field
287
288 if( rEnd.InField() && rEnd.GetFieldOffset() >= rEnd.GetFieldLen() - 1 )
289 return false; // within field
290
291 return true;
292}
293
294
295SvxEditSourceAdapter::SvxEditSourceAdapter() : mbEditSourceValid( false )
296{
297}
298
299SvxEditSourceAdapter::~SvxEditSourceAdapter()
300{
301}
302
303std::unique_ptr<SvxEditSource> SvxEditSourceAdapter::Clone() const
304{
305 if( mbEditSourceValid && mpAdaptee )
306 {
307 std::unique_ptr< SvxEditSource > pClonedAdaptee( mpAdaptee->Clone() );
308
309 if (pClonedAdaptee)
310 {
311 std::unique_ptr<SvxEditSourceAdapter> pClone(new SvxEditSourceAdapter());
312 pClone->SetEditSource( std::move(pClonedAdaptee) );
313 return std::unique_ptr< SvxEditSource >(pClone.release());
314 }
315 }
316
317 return nullptr;
318}
319
320SvxAccessibleTextAdapter* SvxEditSourceAdapter::GetTextForwarderAdapter()
321{
322 if( mbEditSourceValid && mpAdaptee )
323 {
324 SvxTextForwarder* pTextForwarder = mpAdaptee->GetTextForwarder();
325
326 if( pTextForwarder )
327 {
328 maTextAdapter.SetForwarder(*pTextForwarder);
329
330 return &maTextAdapter;
331 }
332 }
333
334 return nullptr;
335}
336
337SvxTextForwarder* SvxEditSourceAdapter::GetTextForwarder()
338{
339 return GetTextForwarderAdapter();
340}
341
342SvxViewForwarder* SvxEditSourceAdapter::GetViewForwarder()
343{
344 if( mbEditSourceValid && mpAdaptee )
345 return mpAdaptee->GetViewForwarder();
346
347 return nullptr;
348}
349
350SvxAccessibleTextEditViewAdapter* SvxEditSourceAdapter::GetEditViewForwarderAdapter( bool bCreate )
351{
352 if( mbEditSourceValid && mpAdaptee )
353 {
354 SvxEditViewForwarder* pEditViewForwarder = mpAdaptee->GetEditViewForwarder(bCreate);
355
356 if( pEditViewForwarder )
357 {
358 SvxAccessibleTextAdapter* pTextAdapter = GetTextForwarderAdapter();
359
360 if( pTextAdapter )
361 {
362 maEditViewAdapter.SetForwarder(*pEditViewForwarder, *pTextAdapter);
363
364 return &maEditViewAdapter;
365 }
366 }
367 }
368
369 return nullptr;
370}
371
372SvxEditViewForwarder* SvxEditSourceAdapter::GetEditViewForwarder( bool bCreate )
373{
374 return GetEditViewForwarderAdapter( bCreate );
375}
376
377void SvxEditSourceAdapter::UpdateData()
378{
379 if( mbEditSourceValid && mpAdaptee )
380 mpAdaptee->UpdateData();
381}
382
383SfxBroadcaster& SvxEditSourceAdapter::GetBroadcaster() const
384{
385 if( mbEditSourceValid && mpAdaptee )
386 return mpAdaptee->GetBroadcaster();
387
388 return maDummyBroadcaster;
389}
390
391void SvxEditSourceAdapter::SetEditSource( std::unique_ptr< SvxEditSource > && pAdaptee )
392{
393 if (pAdaptee)
394 {
395 mpAdaptee = std::move(pAdaptee);
396 mbEditSourceValid = true;
397 }
398 else
399 {
400 // do a lazy delete (prevents us from deleting the broadcaster
401 // from within a broadcast in
402 // AccessibleTextHelper_Impl::Notify)
403 mbEditSourceValid = false;
404 }
405}
406
408 : mpTextForwarder(nullptr)
409{
410}
411
413{
414}
415
417{
418 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
419
421}
422
423sal_Int32 SvxAccessibleTextAdapter::GetTextLen( sal_Int32 nParagraph ) const
424{
425 SvxAccessibleTextIndex aIndex;
426 aIndex.SetEEIndex( nParagraph, mpTextForwarder->GetTextLen( nParagraph ), *this );
427
428 return aIndex.GetIndex();
429}
430
432{
433 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
434
435 SvxAccessibleTextIndex aStartIndex;
436 SvxAccessibleTextIndex aEndIndex;
437
438 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
439 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
440
441 // normalize selection
442 if( rSel.nStartPara > rSel.nEndPara ||
443 (rSel.nStartPara == rSel.nEndPara && rSel.nStartPos > rSel.nEndPos) )
444 {
445 std::swap( aStartIndex, aEndIndex );
446 }
447
448 OUString sStr = mpTextForwarder->GetText( MakeEESelection(aStartIndex, aEndIndex) );
449
450 // trim field text, if necessary
451 if( aStartIndex.InField() )
452 {
453 DBG_ASSERT(aStartIndex.GetFieldOffset() >= 0,
454 "SvxAccessibleTextIndex::GetText: index value overflow");
455
456 sStr = sStr.copy( aStartIndex.GetFieldOffset() );
457 }
458 if( aEndIndex.InField() && aEndIndex.GetFieldOffset() )
459 {
460 DBG_ASSERT(sStr.getLength() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) >= 0,
461 "SvxAccessibleTextIndex::GetText: index value overflow");
462
463 sStr = sStr.copy(0, sStr.getLength() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) );
464 }
465
466 EBulletInfo aBulletInfo2 = GetBulletInfo( aEndIndex.GetParagraph() );
467
468 if( aEndIndex.InBullet() )
469 {
470 // append trailing bullet
471 sStr += aBulletInfo2.aText;
472
473 DBG_ASSERT(sStr.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) >= 0,
474 "SvxAccessibleTextIndex::GetText: index value overflow");
475
476 sStr = sStr.copy(0, sStr.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) );
477 }
478 else if( aStartIndex.GetParagraph() != aEndIndex.GetParagraph() &&
479 HaveTextBullet( aEndIndex.GetParagraph() ) )
480 {
481 OUString sBullet = aBulletInfo2.aText;
482
483 DBG_ASSERT(sBullet.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) >= 0,
484 "SvxAccessibleTextIndex::GetText: index value overflow");
485
486 sBullet = sBullet.copy(0, sBullet.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) );
487
488 // insert bullet
489 sStr = sStr.replaceAt( GetTextLen(aStartIndex.GetParagraph()) - aStartIndex.GetIndex(), 0, sBullet );
490 }
491
492 return sStr;
493}
494
496{
497 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
498
499 SvxAccessibleTextIndex aStartIndex;
500 SvxAccessibleTextIndex aEndIndex;
501
502 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
503 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
504
505 return mpTextForwarder->GetAttribs( MakeEESelection(aStartIndex, aEndIndex), nOnlyHardAttrib );
506}
507
509{
510 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
511
512 return mpTextForwarder->GetParaAttribs( nPara );
513}
514
515void SvxAccessibleTextAdapter::SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet )
516{
517 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
518
520}
521
523{
524}
525
526void SvxAccessibleTextAdapter::GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const
527{
528 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
529
530 mpTextForwarder->GetPortions( nPara, rList );
531}
532
533OUString SvxAccessibleTextAdapter::GetStyleSheet(sal_Int32 nPara) const
534{
535 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
536
537 return mpTextForwarder->GetStyleSheet(nPara);
538}
539
540void SvxAccessibleTextAdapter::SetStyleSheet(sal_Int32 nPara, const OUString& rStyleName)
541{
542 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
543
544 mpTextForwarder->SetStyleSheet(nPara, rStyleName);
545}
546
548{
549 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
550
551 SvxAccessibleTextIndex aStartIndex;
552 SvxAccessibleTextIndex aEndIndex;
553
554 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
555 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
556
557 return mpTextForwarder->GetItemState( MakeEESelection(aStartIndex, aEndIndex),
558 nWhich );
559}
560
561SfxItemState SvxAccessibleTextAdapter::GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const
562{
563 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
564
565 return mpTextForwarder->GetItemState( nPara, nWhich );
566}
567
568void SvxAccessibleTextAdapter::QuickInsertText( const OUString& rText, const ESelection& rSel )
569{
570 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
571
572 SvxAccessibleTextIndex aStartIndex;
573 SvxAccessibleTextIndex aEndIndex;
574
575 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
576 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
577
579 MakeEESelection(aStartIndex, aEndIndex) );
580}
581
583{
584 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
585
586 SvxAccessibleTextIndex aStartIndex;
587 SvxAccessibleTextIndex aEndIndex;
588
589 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
590 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
591
593 MakeEESelection(aStartIndex, aEndIndex) );
594}
595
597{
598 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
599
600 SvxAccessibleTextIndex aStartIndex;
601 SvxAccessibleTextIndex aEndIndex;
602
603 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
604 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
605
607 MakeEESelection(aStartIndex, aEndIndex) );
608}
609
611{
612 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
613
614 SvxAccessibleTextIndex aStartIndex;
615 SvxAccessibleTextIndex aEndIndex;
616
617 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
618 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
619
620 mpTextForwarder->QuickInsertLineBreak( MakeEESelection(aStartIndex, aEndIndex) );
621}
622
624{
625 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
626
627 return mpTextForwarder->GetPool();
628}
629
630OUString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle )
631{
632 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
633
634 return mpTextForwarder->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor, rpFldLineStyle );
635}
636
638{
639 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
640
641 mpTextForwarder->FieldClicked( rField );
642}
643
644sal_Int32 SvxAccessibleTextAdapter::CalcEditEngineIndex( sal_Int32 nPara, sal_Int32 nLogicalIndex )
645{
646 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
647
648 SvxAccessibleTextIndex aIndex;
649 aIndex.SetIndex(nPara, nLogicalIndex, *mpTextForwarder);
650 return aIndex.GetEEIndex();
651}
652
654{
655 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
656
657 if( mpTextForwarder )
658 return mpTextForwarder->IsValid();
659 else
660 return false;
661}
662
663LanguageType SvxAccessibleTextAdapter::GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const
664{
665 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
666
667 SvxAccessibleTextIndex aIndex;
668
669 aIndex.SetIndex( nPara, nPos, *this );
670
671 return mpTextForwarder->GetLanguage( nPara, aIndex.GetEEIndex() );
672}
673
674sal_Int32 SvxAccessibleTextAdapter::GetFieldCount( sal_Int32 nPara ) const
675{
676 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
677
678 return mpTextForwarder->GetFieldCount( nPara );
679}
680
681EFieldInfo SvxAccessibleTextAdapter::GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const
682{
683 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
684
685 return mpTextForwarder->GetFieldInfo( nPara, nField );
686}
687
689{
690 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
691
692 return mpTextForwarder->GetBulletInfo( nPara );
693}
694
695tools::Rectangle SvxAccessibleTextAdapter::GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const
696{
697 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
698
699 SvxAccessibleTextIndex aIndex;
700 aIndex.SetIndex( nPara, nIndex, *this );
701
702 // preset if anything goes wrong below
703 // n-th char in GetParagraphIndex's paragraph
704 tools::Rectangle aRect = mpTextForwarder->GetCharBounds( nPara, aIndex.GetEEIndex() );
705
706 if( aIndex.InBullet() )
707 {
708 EBulletInfo aBulletInfo = GetBulletInfo( nPara );
709
710 OutputDevice* pOutDev = GetRefDevice();
711
712 DBG_ASSERT(pOutDev!=nullptr, "SvxAccessibleTextAdapter::GetCharBounds: No ref device");
713
714 // preset if anything goes wrong below
715 aRect = aBulletInfo.aBounds; // better than nothing
716 if( pOutDev )
717 {
718 AccessibleStringWrap aStringWrap( *pOutDev, aBulletInfo.aFont, aBulletInfo.aText );
719
720 aStringWrap.GetCharacterBounds( aIndex.GetBulletOffset(), aRect );
721 aRect.Move( aBulletInfo.aBounds.Left(), aBulletInfo.aBounds.Top() );
722 }
723 }
724 else
725 {
726 // handle field content manually
727 if( aIndex.InField() )
728 {
729 OutputDevice* pOutDev = GetRefDevice();
730
731 DBG_ASSERT(pOutDev!=nullptr, "SvxAccessibleTextAdapter::GetCharBounds: No ref device");
732
733 if( pOutDev )
734 {
736
738 AccessibleStringWrap aStringWrap( *pOutDev,
739 aFont,
740 mpTextForwarder->GetText( aSel ) );
741
742 tools::Rectangle aStartRect = mpTextForwarder->GetCharBounds( nPara, aIndex.GetEEIndex() );
743
744 aStringWrap.GetCharacterBounds( aIndex.GetFieldOffset(), aRect );
745 aRect.Move( aStartRect.Left(), aStartRect.Top() );
746 }
747 }
748 }
749
750 return aRect;
751}
752
754{
755 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
756
757 EBulletInfo aBulletInfo = GetBulletInfo( nPara );
758
759 if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
760 aBulletInfo.bVisible &&
761 aBulletInfo.nType != SVX_NUM_BITMAP )
762 {
763 // include bullet in para bounding box
765
766 aRect.Union( aBulletInfo.aBounds );
767
768 return aRect;
769 }
770
771 return mpTextForwarder->GetParaBounds( nPara );
772}
773
775{
776 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
777
778 return mpTextForwarder->GetMapMode();
779}
780
782{
783 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
784
786}
787
788bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, sal_Int32& nPara, sal_Int32& nIndex ) const
789{
790 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
791
792 if( !mpTextForwarder->GetIndexAtPoint( rPoint, nPara, nIndex ) )
793 return false;
794
795 SvxAccessibleTextIndex aIndex;
796 aIndex.SetEEIndex(nPara, nIndex, *this);
797
798 DBG_ASSERT(aIndex.GetIndex() >= 0,
799 "SvxAccessibleTextIndex::SetIndex: index value overflow");
800
801 nIndex = aIndex.GetIndex();
802
803 EBulletInfo aBulletInfo = GetBulletInfo( nPara );
804
805 // any text bullets?
806 if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
807 aBulletInfo.bVisible &&
808 aBulletInfo.nType != SVX_NUM_BITMAP )
809 {
810 if( aBulletInfo.aBounds.Contains( rPoint) )
811 {
812 OutputDevice* pOutDev = GetRefDevice();
813
814 DBG_ASSERT(pOutDev!=nullptr, "SvxAccessibleTextAdapter::GetIndexAtPoint: No ref device");
815
816 if( !pOutDev )
817 return false;
818
819 AccessibleStringWrap aStringWrap( *pOutDev, aBulletInfo.aFont, aBulletInfo.aText );
820
821 Point aPoint = rPoint;
822 aPoint.Move( -aBulletInfo.aBounds.Left(), -aBulletInfo.aBounds.Top() );
823
824 DBG_ASSERT(aStringWrap.GetIndexAtPoint( aPoint ) >= 0,
825 "SvxAccessibleTextIndex::SetIndex: index value overflow");
826
827 nIndex = aStringWrap.GetIndexAtPoint( aPoint );
828 return true;
829 }
830 }
831
832 if( !aIndex.InField() )
833 return true;
834
835 OutputDevice* pOutDev = GetRefDevice();
836
837 DBG_ASSERT(pOutDev!=nullptr, "SvxAccessibleTextAdapter::GetIndexAtPoint: No ref device");
838
839 if( !pOutDev )
840 return false;
841
842 ESelection aSelection = MakeEESelection( aIndex );
844 AccessibleStringWrap aStringWrap( *pOutDev,
845 aFont,
846 mpTextForwarder->GetText( aSelection ) );
847
848 tools::Rectangle aRect = mpTextForwarder->GetCharBounds( nPara, aIndex.GetEEIndex() );
849 Point aPoint = rPoint;
850 aPoint.Move( -aRect.Left(), -aRect.Top() );
851
852 DBG_ASSERT(aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( rPoint ) >= 0,
853 "SvxAccessibleTextIndex::SetIndex: index value overflow");
854
855 nIndex = (aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( aPoint ));
856 return true;
857}
858
859bool SvxAccessibleTextAdapter::GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart, sal_Int32& nEnd ) const
860{
861 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
862
863 SvxAccessibleTextIndex aIndex;
864 aIndex.SetIndex(nPara, nIndex, *this);
865 nIndex = aIndex.GetEEIndex();
866
867 if( aIndex.InBullet() )
868 {
869 DBG_ASSERT(aIndex.GetBulletLen() >= 0,
870 "SvxAccessibleTextIndex::SetIndex: index value overflow");
871
872 // always treat bullet as separate word
873 nStart = 0;
874 nEnd = aIndex.GetBulletLen();
875
876 return true;
877 }
878
879 if( aIndex.InField() )
880 {
881 DBG_ASSERT(aIndex.GetIndex() - aIndex.GetFieldOffset() >= 0 &&
882 nStart + aIndex.GetFieldLen() >= 0,
883 "SvxAccessibleTextIndex::SetIndex: index value overflow");
884
885 // always treat field as separate word
886 // TODO: to circumvent this, _we_ would have to do the break iterator stuff!
887 nStart = aIndex.GetIndex() - aIndex.GetFieldOffset();
888 nEnd = nStart + aIndex.GetFieldLen();
889
890 return true;
891 }
892
893 if( !mpTextForwarder->GetWordIndices( nPara, nIndex, nStart, nEnd ) )
894 return false;
895
896 aIndex.SetEEIndex( nPara, nStart, *this );
897 DBG_ASSERT(aIndex.GetIndex() >= 0,
898 "SvxAccessibleTextIndex::SetIndex: index value overflow");
899 nStart = aIndex.GetIndex();
900
901 aIndex.SetEEIndex( nPara, nEnd, *this );
902 DBG_ASSERT(aIndex.GetIndex() >= 0,
903 "SvxAccessibleTextIndex::SetIndex: index value overflow");
904 nEnd = aIndex.GetIndex();
905
906 return true;
907}
908
909bool SvxAccessibleTextAdapter::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool /* bInCell */ ) const
910{
911 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
912
913 SvxAccessibleTextIndex aIndex;
914 aIndex.SetIndex(nPara, nIndex, *this);
915 nIndex = aIndex.GetEEIndex();
916
917 if( aIndex.InBullet() )
918 {
919 DBG_ASSERT(aIndex.GetBulletLen() >= 0,
920 "SvxAccessibleTextIndex::SetIndex: index value overflow");
921
922 // always treat bullet as distinct attribute
923 nStartIndex = 0;
924 nEndIndex = aIndex.GetBulletLen();
925
926 return true;
927 }
928
929 if( aIndex.InField() )
930 {
931 DBG_ASSERT(aIndex.GetIndex() - aIndex.GetFieldOffset() >= 0,
932 "SvxAccessibleTextIndex::SetIndex: index value overflow");
933
934 // always treat field as distinct attribute
935 nStartIndex = aIndex.GetIndex() - aIndex.GetFieldOffset();
936 nEndIndex = nStartIndex + aIndex.GetFieldLen();
937
938 return true;
939 }
940
941 if( !mpTextForwarder->GetAttributeRun( nStartIndex, nEndIndex, nPara, nIndex ) )
942 return false;
943
944 aIndex.SetEEIndex( nPara, nStartIndex, *this );
945 DBG_ASSERT(aIndex.GetIndex() >= 0,
946 "SvxAccessibleTextIndex::SetIndex: index value overflow");
947 nStartIndex = aIndex.GetIndex();
948
949 aIndex.SetEEIndex( nPara, nEndIndex, *this );
950 DBG_ASSERT(aIndex.GetIndex() >= 0,
951 "SvxAccessibleTextIndex::SetIndex: index value overflow");
952 nEndIndex = aIndex.GetIndex();
953
954 return true;
955}
956
957sal_Int32 SvxAccessibleTextAdapter::GetLineCount( sal_Int32 nPara ) const
958{
959 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
960
961 return mpTextForwarder->GetLineCount( nPara );
962}
963
964sal_Int32 SvxAccessibleTextAdapter::GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const
965{
966 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
967
968 SvxAccessibleTextIndex aEndIndex;
969 sal_Int32 nCurrLine;
970 sal_Int32 nCurrIndex, nLastIndex;
971 for( nCurrLine=0, nCurrIndex=0, nLastIndex=0; nCurrLine<=nLine; ++nCurrLine )
972 {
973 nLastIndex = nCurrIndex;
974 nCurrIndex =
975 nCurrIndex + mpTextForwarder->GetLineLen( nPara, nCurrLine );
976 }
977
978 aEndIndex.SetEEIndex( nPara, nCurrIndex, *this );
979 if( nLine > 0 )
980 {
981 SvxAccessibleTextIndex aStartIndex;
982 aStartIndex.SetEEIndex( nPara, nLastIndex, *this );
983
984 return aEndIndex.GetIndex() - aStartIndex.GetIndex();
985 }
986 else
987 return aEndIndex.GetIndex();
988}
989
990void SvxAccessibleTextAdapter::GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const
991{
992 mpTextForwarder->GetLineBoundaries( rStart, rEnd, nParagraph, nLine );
993}
994
995sal_Int32 SvxAccessibleTextAdapter::GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const
996{
998}
999
1001{
1002 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
1003
1004 SvxAccessibleTextIndex aStartIndex;
1005 SvxAccessibleTextIndex aEndIndex;
1006
1007 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
1008 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
1009
1010 return mpTextForwarder->Delete( MakeEESelection(aStartIndex, aEndIndex ) );
1011}
1012
1013bool SvxAccessibleTextAdapter::InsertText( const OUString& rStr, const ESelection& rSel )
1014{
1015 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
1016
1017 SvxAccessibleTextIndex aStartIndex;
1018 SvxAccessibleTextIndex aEndIndex;
1019
1020 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
1021 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
1022
1023 return mpTextForwarder->InsertText( rStr, MakeEESelection(aStartIndex, aEndIndex) );
1024}
1025
1027{
1028 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
1029
1030 return mpTextForwarder->QuickFormatDoc( bFull );
1031}
1032
1033sal_Int16 SvxAccessibleTextAdapter::GetDepth( sal_Int32 nPara ) const
1034{
1035 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
1036
1037 return mpTextForwarder->GetDepth( nPara );
1038}
1039
1040bool SvxAccessibleTextAdapter::SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth )
1041{
1042 assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
1043
1044 return mpTextForwarder->SetDepth( nPara, nNewDepth );
1045}
1046
1048{
1049 mpTextForwarder = &rForwarder;
1050}
1051
1053{
1054 EBulletInfo aBulletInfo = GetBulletInfo( nPara );
1055
1056 return ( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
1057 aBulletInfo.bVisible &&
1058 aBulletInfo.nType == SVX_NUM_BITMAP );
1059}
1060
1061bool SvxAccessibleTextAdapter::HaveTextBullet( sal_Int32 nPara ) const
1062{
1063 EBulletInfo aBulletInfo = GetBulletInfo( nPara );
1064
1065 return ( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
1066 aBulletInfo.bVisible &&
1067 aBulletInfo.nType != SVX_NUM_BITMAP );
1068}
1069
1071{
1072 SvxAccessibleTextIndex aStartIndex;
1073 SvxAccessibleTextIndex aEndIndex;
1074
1075 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
1076 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
1077
1078 // normalize selection
1079 if( rSel.nStartPara > rSel.nEndPara ||
1080 (rSel.nStartPara == rSel.nEndPara && rSel.nStartPos > rSel.nEndPos) )
1081 {
1082 std::swap( aStartIndex, aEndIndex );
1083 }
1084
1085 return aStartIndex.IsEditableRange( aEndIndex );
1086}
1087
1089{
1090 OSL_FAIL( "not implemented" );
1091 return nullptr;
1092}
1093
1095{
1096 OSL_FAIL( "not implemented" );
1097}
1098
1099sal_Int32 SvxAccessibleTextAdapter::AppendTextPortion( sal_Int32, const OUString &, const SfxItemSet & )
1100{
1101 OSL_FAIL( "not implemented" );
1102 return 0;
1103}
1105{
1106 OSL_FAIL( "not implemented" );
1107}
1108
1110 : mpViewForwarder(nullptr)
1111 , mpTextForwarder(nullptr)
1112{
1113}
1114
1116{
1117}
1118
1120{
1121 DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1122
1123 if( mpViewForwarder )
1124 return mpViewForwarder->IsValid();
1125 else
1126 return false;
1127}
1128
1130{
1131 DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1132
1133 return mpViewForwarder->LogicToPixel(rPoint, rMapMode);
1134}
1135
1137{
1138 DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1139
1140 return mpViewForwarder->PixelToLogic(rPoint, rMapMode);
1141}
1142
1144{
1145 DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1146
1147 ESelection aSelection;
1148
1149 if( !mpViewForwarder->GetSelection( aSelection ) )
1150 return false;
1151
1152 SvxAccessibleTextIndex aStartIndex;
1153 SvxAccessibleTextIndex aEndIndex;
1154
1155 aStartIndex.SetEEIndex( aSelection.nStartPara, aSelection.nStartPos, *mpTextForwarder );
1156 aEndIndex.SetEEIndex( aSelection.nEndPara, aSelection.nEndPos, *mpTextForwarder );
1157
1158 DBG_ASSERT(aStartIndex.GetIndex() >= 0 &&
1159 aEndIndex.GetIndex() >= 0,
1160 "SvxAccessibleTextEditViewAdapter::GetSelection: index value overflow");
1161
1162 rSel = ESelection( aStartIndex.GetParagraph(), aStartIndex.GetIndex(),
1163 aEndIndex.GetParagraph(), aEndIndex.GetIndex() );
1164
1165 return true;
1166}
1167
1169{
1170 DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1171
1172 SvxAccessibleTextIndex aStartIndex;
1173 SvxAccessibleTextIndex aEndIndex;
1174
1175 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *mpTextForwarder );
1176 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *mpTextForwarder );
1177
1178 return mpViewForwarder->SetSelection( MakeEESelection(aStartIndex, aEndIndex) );
1179}
1180
1182{
1183 DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1184
1185 return mpViewForwarder->Copy();
1186}
1187
1189{
1190 DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1191
1192 return mpViewForwarder->Cut();
1193}
1194
1196{
1197 DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1198
1199 return mpViewForwarder->Paste();
1200}
1201
1203 SvxAccessibleTextAdapter& rTextForwarder )
1204{
1205 mpViewForwarder = &rForwarder;
1206 mpTextForwarder = &rTextForwarder;
1207}
1208
1209/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 GetIndexAtPoint(const Point &rPoint)
void GetCharacterBounds(sal_Int32 nIndex, tools::Rectangle &rRect)
static SvxFont CreateSvxFontFromItemSet(const SfxItemSet &rItemSet)
Definition: editeng.cxx:2712
void Move(tools::Long nHorzMove, tools::Long nVertMove)
virtual void QuickSetAttribs(const SfxItemSet &rSet, const ESelection &rSel) override
Definition: unoedprx.cxx:596
virtual bool QuickFormatDoc(bool bFull=false) override
Updates the formatting.
Definition: unoedprx.cxx:1026
virtual OUString CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_Int32 nPos, std::optional< Color > &rpTxtColor, std::optional< Color > &rpFldColor, std::optional< FontLineStyle > &rpFldLineStyle) override
Definition: unoedprx.cxx:630
virtual LanguageType GetLanguage(sal_Int32, sal_Int32) const override
Query language of character at given position on the underlying edit engine.
Definition: unoedprx.cxx:663
virtual SfxItemSet GetParaAttribs(sal_Int32 nPara) const override
Definition: unoedprx.cxx:508
virtual bool Delete(const ESelection &) override
Delete given text range and reformat text.
Definition: unoedprx.cxx:1000
virtual sal_Int32 GetTextLen(sal_Int32 nParagraph) const override
Definition: unoedprx.cxx:423
virtual void RemoveAttribs(const ESelection &rSelection) override
Definition: unoedprx.cxx:522
virtual void GetPortions(sal_Int32 nPara, std::vector< sal_Int32 > &rList) const override
Definition: unoedprx.cxx:526
virtual sal_Int32 GetFieldCount(sal_Int32 nPara) const override
Query number of fields in the underlying edit engine.
Definition: unoedprx.cxx:674
virtual OUString GetText(const ESelection &rSel) const override
Definition: unoedprx.cxx:431
virtual EBulletInfo GetBulletInfo(sal_Int32 nPara) const override
Query information regarding bullets for given paragraph on the underlying edit engine.
Definition: unoedprx.cxx:688
virtual MapMode GetMapMode() const override
Query the map mode of the underlying EditEngine/Outliner.
Definition: unoedprx.cxx:774
virtual SfxItemSet GetAttribs(const ESelection &rSel, EditEngineAttribs nOnlyHardAttrib=EditEngineAttribs::All) const override
Definition: unoedprx.cxx:495
virtual void GetLineBoundaries(sal_Int32 &rStart, sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine) const override
Query bounds of line in paragraph.
Definition: unoedprx.cxx:990
virtual void SetParaAttribs(sal_Int32 nPara, const SfxItemSet &rSet) override
Definition: unoedprx.cxx:515
bool HaveTextBullet(sal_Int32 nPara) const
Definition: unoedprx.cxx:1061
virtual void QuickInsertLineBreak(const ESelection &rSel) override
Definition: unoedprx.cxx:610
bool IsEditable(const ESelection &rSelection) const
Query whether all text in given selection is editable.
Definition: unoedprx.cxx:1070
sal_Int32 CalcEditEngineIndex(sal_Int32 nPara, sal_Int32 nLogicalIndex)
Definition: unoedprx.cxx:644
virtual bool GetWordIndices(sal_Int32 nPara, sal_Int32 nIndex, sal_Int32 &nStart, sal_Int32 &nEnd) const override
Get the start and the end index of the word at the given index.
Definition: unoedprx.cxx:859
virtual void SetStyleSheet(sal_Int32 nPara, const OUString &rStyleName) override
Definition: unoedprx.cxx:540
virtual bool GetIndexAtPoint(const Point &, sal_Int32 &nPara, sal_Int32 &nIndex) const override
Query paragraph and character index of the character at the given point.
Definition: unoedprx.cxx:788
virtual bool InsertText(const OUString &, const ESelection &) override
Insert/Replace given text in given range and reformat text.
Definition: unoedprx.cxx:1013
SvxTextForwarder * mpTextForwarder
Definition: unoedprx.hxx:112
virtual bool GetAttributeRun(sal_Int32 &nStartIndex, sal_Int32 &nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell=false) const override
Query range of similar attributes.
Definition: unoedprx.cxx:909
virtual bool IsValid() const override
Query state of forwarder.
Definition: unoedprx.cxx:653
virtual void FieldClicked(const SvxFieldItem &rField) override
Definition: unoedprx.cxx:637
virtual SfxItemState GetItemState(const ESelection &rSel, sal_uInt16 nWhich) const override
Definition: unoedprx.cxx:547
virtual void AppendParagraph() override
Definition: unoedprx.cxx:1094
virtual bool SetDepth(sal_Int32 nPara, sal_Int16 nNewDepth) override
Set the outline depth of given paragraph.
Definition: unoedprx.cxx:1040
virtual EFieldInfo GetFieldInfo(sal_Int32 nPara, sal_uInt16 nField) const override
Query information for given field number in the underlying edit engine.
Definition: unoedprx.cxx:681
virtual sal_Int32 GetLineCount(sal_Int32 nPara) const override
Query number of lines in the formatted paragraph.
Definition: unoedprx.cxx:957
virtual tools::Rectangle GetCharBounds(sal_Int32 nPara, sal_Int32 nIndex) const override
Query the bounding rectangle of the given character.
Definition: unoedprx.cxx:695
virtual sal_Int32 AppendTextPortion(sal_Int32 nPara, const OUString &rText, const SfxItemSet &rSet) override
Definition: unoedprx.cxx:1099
virtual sal_Int32 GetLineNumberAtIndex(sal_Int32 nPara, sal_Int32 nIndex) const override
Query the line number for an index in the paragraphs text.
Definition: unoedprx.cxx:995
virtual SfxItemPool * GetPool() const override
Definition: unoedprx.cxx:623
virtual sal_Int16 GetDepth(sal_Int32 nPara) const override
Get the outline depth of given paragraph.
Definition: unoedprx.cxx:1033
virtual void CopyText(const SvxTextForwarder &rSource) override
Definition: unoedprx.cxx:1104
virtual tools::Rectangle GetParaBounds(sal_Int32 nPara) const override
Query the bounding rectangle of the given paragraph.
Definition: unoedprx.cxx:753
virtual OutputDevice * GetRefDevice() const override
Query the reference output device of the underlying EditEngine/Outliner.
Definition: unoedprx.cxx:781
virtual OUString GetStyleSheet(sal_Int32 nPara) const override
Definition: unoedprx.cxx:533
virtual sal_Int32 GetParagraphCount() const override
Definition: unoedprx.cxx:416
virtual const SfxItemSet * GetEmptyItemSetPtr() override
Definition: unoedprx.cxx:1088
virtual ~SvxAccessibleTextAdapter() override
Definition: unoedprx.cxx:412
bool HaveImageBullet(sal_Int32 nPara) const
Definition: unoedprx.cxx:1052
void SetForwarder(SvxTextForwarder &)
Definition: unoedprx.cxx:1047
virtual sal_Int32 GetLineLen(sal_Int32 nPara, sal_Int32 nLine) const override
Query line length.
Definition: unoedprx.cxx:964
virtual void QuickInsertText(const OUString &rText, const ESelection &rSel) override
Definition: unoedprx.cxx:568
virtual void QuickInsertField(const SvxFieldItem &rFld, const ESelection &rSel) override
Definition: unoedprx.cxx:582
virtual Point PixelToLogic(const Point &rPoint, const MapMode &rMapMode) const override
Convert from screen to logical, EditEngine-relative coordinates.
Definition: unoedprx.cxx:1136
void SetForwarder(SvxEditViewForwarder &, SvxAccessibleTextAdapter &)
Definition: unoedprx.cxx:1202
SvxEditViewForwarder * mpViewForwarder
Definition: unoedprx.hxx:137
virtual ~SvxAccessibleTextEditViewAdapter() override
Definition: unoedprx.cxx:1115
virtual bool IsValid() const override
Query state of forwarder.
Definition: unoedprx.cxx:1119
virtual bool Cut() override
Cut current selection to clipboard.
Definition: unoedprx.cxx:1188
virtual Point LogicToPixel(const Point &rPoint, const MapMode &rMapMode) const override
Convert from logical, EditEngine-relative coordinates to screen coordinates.
Definition: unoedprx.cxx:1129
virtual bool Paste() override
Paste clipboard into current selection.
Definition: unoedprx.cxx:1195
virtual bool SetSelection(const ESelection &rSelection) override
Set selection in view.
Definition: unoedprx.cxx:1168
SvxAccessibleTextAdapter * mpTextForwarder
Definition: unoedprx.hxx:138
virtual bool GetSelection(ESelection &rSelection) const override
Query current selection.
Definition: unoedprx.cxx:1143
virtual bool Copy() override
Copy current selection to clipboard.
Definition: unoedprx.cxx:1181
Encapsulates EditView and OutlinerView for the purpose of unified EditEngine/Outliner access.
Definition: unoedsrc.hxx:493
virtual bool Copy()=0
Copy current selection to clipboard.
virtual bool SetSelection(const ESelection &rSelection)=0
Set selection in view.
virtual bool Paste()=0
Paste clipboard into current selection.
virtual bool GetSelection(ESelection &rSelection) const =0
Query current selection.
virtual bool Cut()=0
Cut current selection to clipboard.
This item stores a field (SvxFieldData).
Definition: flditem.hxx:70
Contains an EditEngine or an Outliner and unifies access to them.
Definition: unoedsrc.hxx:142
virtual bool IsValid() const =0
Query state of forwarder.
virtual void QuickInsertText(const OUString &rText, const ESelection &rSel)=0
virtual MapMode GetMapMode() const =0
Query the map mode of the underlying EditEngine/Outliner.
virtual void QuickInsertLineBreak(const ESelection &rSel)=0
virtual void SetStyleSheet(sal_Int32 nPara, const OUString &rStyleName)=0
virtual void QuickSetAttribs(const SfxItemSet &rSet, const ESelection &rSel)=0
virtual bool GetAttributeRun(sal_Int32 &nStartIndex, sal_Int32 &nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell=false) const =0
Query range of similar attributes.
virtual OutputDevice * GetRefDevice() const =0
Query the reference output device of the underlying EditEngine/Outliner.
virtual LanguageType GetLanguage(sal_Int32 nPara, sal_Int32 nIndex) const =0
Query language of character at given position on the underlying edit engine.
virtual OUString GetStyleSheet(sal_Int32 nPara) const =0
virtual bool SetDepth(sal_Int32 nPara, sal_Int16 nNewDepth)=0
Set the outline depth of given paragraph.
virtual SfxItemSet GetAttribs(const ESelection &rSel, EditEngineAttribs nOnlyHardAttrib=EditEngineAttribs::All) const =0
virtual void GetPortions(sal_Int32 nPara, std::vector< sal_Int32 > &rList) const =0
virtual sal_Int32 GetFieldCount(sal_Int32 nPara) const =0
Query number of fields in the underlying edit engine.
virtual bool QuickFormatDoc(bool bFull=false)=0
Updates the formatting.
virtual void FieldClicked(const SvxFieldItem &rField)=0
virtual sal_Int16 GetDepth(sal_Int32 nPara) const =0
Get the outline depth of given paragraph.
virtual bool Delete(const ESelection &rSelection)=0
Delete given text range and reformat text.
virtual SfxItemSet GetParaAttribs(sal_Int32 nPara) const =0
virtual EBulletInfo GetBulletInfo(sal_Int32 nPara) const =0
Query information regarding bullets for given paragraph on the underlying edit engine.
virtual EFieldInfo GetFieldInfo(sal_Int32 nPara, sal_uInt16 nField) const =0
Query information for given field number in the underlying edit engine.
virtual SfxItemPool * GetPool() const =0
virtual OUString CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_Int32 nPos, std::optional< Color > &rpTxtColor, std::optional< Color > &rpFldColor, std::optional< FontLineStyle > &rpFldLineStyle)=0
virtual tools::Rectangle GetParaBounds(sal_Int32 nPara) const =0
Query the bounding rectangle of the given paragraph.
virtual tools::Rectangle GetCharBounds(sal_Int32 nPara, sal_Int32 nIndex) const =0
Query the bounding rectangle of the given character.
virtual sal_Int32 GetTextLen(sal_Int32 nParagraph) const =0
virtual sal_Int32 GetLineCount(sal_Int32 nPara) const =0
Query number of lines in the formatted paragraph.
virtual OUString GetText(const ESelection &rSel) const =0
virtual void SetParaAttribs(sal_Int32 nPara, const SfxItemSet &rSet)=0
virtual bool GetIndexAtPoint(const Point &rPoint, sal_Int32 &rPara, sal_Int32 &rIndex) const =0
Query paragraph and character index of the character at the given point.
virtual void GetLineBoundaries(sal_Int32 &rStart, sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine) const =0
Query bounds of line in paragraph.
virtual sal_Int32 GetParagraphCount() const =0
virtual bool GetWordIndices(sal_Int32 nPara, sal_Int32 nIndex, sal_Int32 &rStart, sal_Int32 &rEnd) const =0
Get the start and the end index of the word at the given index.
virtual sal_Int32 GetLineLen(sal_Int32 nPara, sal_Int32 nLine) const =0
Query line length.
virtual sal_Int32 GetLineNumberAtIndex(sal_Int32 nPara, sal_Int32 nIndex) const =0
Query the line number for an index in the paragraphs text.
virtual void QuickInsertField(const SvxFieldItem &rFld, const ESelection &rSel)=0
virtual bool InsertText(const OUString &rText, const ESelection &rSel)=0
Insert/Replace given text in given range and reformat text.
virtual SfxItemState GetItemState(const ESelection &rSel, sal_uInt16 nWhich) const =0
Encapsulates the document view for the purpose of unified EditEngine/Outliner access.
Definition: unoedsrc.hxx:452
virtual Point LogicToPixel(const Point &rPoint, const MapMode &rMapMode) const =0
Convert from logical, EditEngine-relative coordinates to screen coordinates.
virtual bool IsValid() const =0
Query state of forwarder.
virtual Point PixelToLogic(const Point &rPoint, const MapMode &rMapMode) const =0
Convert from screen to logical, EditEngine-relative coordinates.
bool Contains(const Point &rPOINT) const
constexpr tools::Long Top() const
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
tools::Rectangle & Union(const tools::Rectangle &rRect)
constexpr tools::Long Left() const
#define DBG_ASSERT(sCon, aError)
#define EE_PARA_NOT_FOUND
Definition: editdata.hxx:48
std::deque< AttacherIndex_Impl > aIndex
EditEngineAttribs
values for: SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEn...
sal_Int32 nIndex
sal_uInt16 nPos
SfxItemState
static SfxItemSet & rSet
sal_uInt16 nType
Definition: outliner.hxx:557
tools::Rectangle aBounds
Definition: outliner.hxx:554
SvxFont aFont
Definition: outliner.hxx:553
sal_Int32 nParagraph
Definition: outliner.hxx:556
OUString aText
Definition: outliner.hxx:555
bool bVisible
Definition: outliner.hxx:558
sal_Int32 nStartPara
Definition: editdata.hxx:113
sal_Int32 nEndPos
Definition: editdata.hxx:116
sal_Int32 nStartPos
Definition: editdata.hxx:114
sal_Int32 nEndPara
Definition: editdata.hxx:115
sal_uInt32 mnIndex
@ SVX_NUM_BITMAP
Definition: svxenum.hxx:153
static ESelection MakeEESelection(const SvxAccessibleTextIndex &rStart, const SvxAccessibleTextIndex &rEnd)
Definition: unoedprx.cxx:122