LibreOffice Module sc (master) 1
textuno.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 <memory>
21#include <sal/config.h>
22#include <sal/log.hxx>
23
24#include <scitems.hxx>
25#include <editeng/eeitem.hxx>
26#include <svx/svdpool.hxx>
27#include <svx/svdobj.hxx>
28#include <editeng/editeng.hxx>
29#include <editeng/editobj.hxx>
30#include <editeng/flditem.hxx>
31#include <editeng/fhgtitem.hxx>
32#include <editeng/unoprnms.hxx>
33#include <editeng/unofored.hxx>
34#include <utility>
35#include <vcl/svapp.hxx>
36
37#include <editeng/unoipset.hxx>
38#include <textuno.hxx>
39#include <fielduno.hxx>
40#include <editsrc.hxx>
41#include <docsh.hxx>
42#include <editutil.hxx>
43#include <miscuno.hxx>
44#include <cellsuno.hxx>
45#include <cellvalue.hxx>
46#include <cellform.hxx>
47#include <patattr.hxx>
48#include <docfunc.hxx>
49#include <scmod.hxx>
50
51using namespace com::sun::star;
52
54{
55 static const SvxItemPropertySet aHdFtPropertySet_Impl = [] {
56 static SfxItemPropertyMapEntry aHdFtPropertyMap_Impl[] =
57 {
61 SVX_UNOEDIT_NUMBERING_PROPERTY, // for completeness of service ParagraphProperties
62 };
63
64 // modify PropertyMap to include CONVERT_TWIPS flag for font height
65 // (headers/footers are in twips)
66
67 for (auto & rEntry : aHdFtPropertyMap_Impl)
68 {
69 if ( ( rEntry.nWID == EE_CHAR_FONTHEIGHT ||
70 rEntry.nWID == EE_CHAR_FONTHEIGHT_CJK ||
71 rEntry.nWID == EE_CHAR_FONTHEIGHT_CTL ) &&
72 rEntry.nMemberId == MID_FONTHEIGHT )
73 {
74 rEntry.nMemberId |= CONVERT_TWIPS;
75 }
76 }
77
78 return SvxItemPropertySet(aHdFtPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool());
79 }();
80 return &aHdFtPropertySet_Impl;
81}
82
83SC_SIMPLE_SERVICE_INFO( ScHeaderFooterContentObj, "ScHeaderFooterContentObj", "com.sun.star.sheet.HeaderFooterContent" )
85
87{
88}
89
91
93{
94 return mxLeftText->GetTextObject();
95}
96
98{
99 return mxCenterText->GetTextObject();
100}
101
103{
104 return mxRightText->GetTextObject();
105}
106
107// XHeaderFooterContent
108
109uno::Reference<text::XText> SAL_CALL ScHeaderFooterContentObj::getLeftText()
110{
111 SolarMutexGuard aGuard;
112 uno::Reference<text::XText> xInt(*mxLeftText, uno::UNO_QUERY);
113 return xInt;
114}
115
116uno::Reference<text::XText> SAL_CALL ScHeaderFooterContentObj::getCenterText()
117{
118 SolarMutexGuard aGuard;
119 uno::Reference<text::XText> xInt(*mxCenterText, uno::UNO_QUERY);
120 return xInt;
121}
122
123uno::Reference<text::XText> SAL_CALL ScHeaderFooterContentObj::getRightText()
124{
125 SolarMutexGuard aGuard;
126 uno::Reference<text::XText> xInt(*mxRightText, uno::UNO_QUERY);
127 return xInt;
128}
129
130// XUnoTunnel
131
133 const uno::Sequence<sal_Int8 >& rId )
134{
135 return comphelper::getSomethingImpl(rId, this);
136}
137
138const uno::Sequence<sal_Int8>& ScHeaderFooterContentObj::getUnoTunnelId()
139{
140 static const comphelper::UnoIdInit theScHeaderFooterContentObjUnoTunnelId;
141 return theScHeaderFooterContentObjUnoTunnelId.getSeq();
142}
143
145 const uno::Reference<sheet::XHeaderFooterContent>& rObj)
146{
147 return comphelper::getFromUnoTunnel<ScHeaderFooterContentObj>(rObj);
148}
149
151 const EditTextObject* pCenter,
152 const EditTextObject* pRight )
153{
154 uno::Reference<css::sheet::XHeaderFooterContent> xThis(this);
158}
159
161 uno::WeakReference<sheet::XHeaderFooterContent> xContent, ScHeaderFooterPart nP, const EditTextObject* pTextObj) :
162 mpTextObj(pTextObj ? pTextObj->Clone() : nullptr),
163 xContentObj(std::move( xContent )),
164 nPart( nP ),
165 bDataValid(false)
166{
167}
168
170{
171 SolarMutexGuard aGuard; // needed for EditEngine dtor
172
173 pForwarder.reset();
174 pEditEngine.reset();
175}
176
178{
179 if (!pEditEngine)
180 {
182 pEnginePool->FreezeIdRanges();
183 std::unique_ptr<ScHeaderEditEngine> pHdrEngine(new ScHeaderEditEngine( pEnginePool.get() ));
184
185 pHdrEngine->EnableUndo( false );
186 pHdrEngine->SetRefMapMode(MapMode(MapUnit::MapTwip));
187
188 // default font must be set, independently of document
189 // -> use global pool from module
190
191 SfxItemSet aDefaults( pHdrEngine->GetEmptyItemSet() );
192 const ScPatternAttr& rPattern = SC_MOD()->GetPool().GetDefaultItem(ATTR_PATTERN);
193 rPattern.FillEditItemSet( &aDefaults );
194 // FillEditItemSet adjusts font height to 1/100th mm,
195 // but for header/footer twips is needed, as in the PatternAttr:
199 pHdrEngine->SetDefaults( aDefaults );
200
203 pHdrEngine->SetData( aData );
204
205 pEditEngine = std::move(pHdrEngine);
207 }
208
209 if (bDataValid)
210 return pForwarder.get();
211
212 if (mpTextObj)
213 pEditEngine->SetTextCurrentDefaults(*mpTextObj);
214
215 bDataValid = true;
216 return pForwarder.get();
217}
218
220{
221 if (pEditEngine)
222 {
223 mpTextObj = pEditEngine->CreateTextObject();
224 }
225}
226
228{
229 mpTextObj = rEditEngine.CreateTextObject();
230 bDataValid = false;
231}
232
234 const uno::WeakReference<sheet::XHeaderFooterContent>& xContent, ScHeaderFooterPart nP, const EditTextObject* pTextObj) :
235 aTextData(xContent, nP, pTextObj)
236{
237 // ScHeaderFooterTextData acquires rContent
238 // pUnoText is created on demand (getString/setString work without it)
239}
240
242{
243 if (!mxUnoText.is())
244 {
245 // can't be aggregated because getString/setString is handled here
247 mxUnoText.set(new SvxUnoText(&aEditSrc, lcl_GetHdFtPropertySet(), uno::Reference<text::XText>()));
248 }
249}
250
252
254{
255 return aTextData.GetTextObject();
256}
257
259{
260 if (!mxUnoText.is())
262 return *mxUnoText;
263}
264
265// XText
266
267uno::Reference<text::XTextCursor> SAL_CALL ScHeaderFooterTextObj::createTextCursor()
268{
269 SolarMutexGuard aGuard;
270 return new ScHeaderFooterTextCursor( this );
271}
272
273uno::Reference<text::XTextCursor> SAL_CALL ScHeaderFooterTextObj::createTextCursorByRange(
274 const uno::Reference<text::XTextRange>& aTextPosition )
275{
276 SolarMutexGuard aGuard;
277 if (!mxUnoText.is())
279 return mxUnoText->createTextCursorByRange(aTextPosition);
281}
282
284{
285 OUString aDummy("???");
286 rData.aTitle = aDummy;
287 rData.aLongDocName = aDummy;
288 rData.aShortDocName = aDummy;
289 rData.aTabName = aDummy;
290 rData.nPageNo = 1;
291 rData.nTotalPages = 99;
292}
293
295{
296 SolarMutexGuard aGuard;
297 OUString aRet;
298 const EditTextObject* pData;
299
300 uno::Reference<css::sheet::XHeaderFooterContent> xContentObj = aTextData.GetContentObj();
301 if (!xContentObj.is())
302 throw css::uno::RuntimeException(
303 "ScHeaderFooterTextObj::getString: no ContentObj");
304
306
307 switch ( aTextData.GetPart() )
308 {
310 pData = pObj->GetLeftEditObject();
311 break;
313 pData = pObj->GetCenterEditObject();
314 break;
316 pData = pObj->GetRightEditObject();
317 break;
318 default:
319 SAL_WARN("sc.ui","unexpected enum value of ScHeaderFooterPart");
320 pData = nullptr;
321 }
322
323 if (pData)
324 {
325 // for pure text, no font info is needed in pool defaults
327
330 aEditEngine.SetData( aData );
331
332 aEditEngine.SetTextCurrentDefaults(*pData);
333 aRet = ScEditUtil::GetSpaceDelimitedString( aEditEngine );
334 }
335 return aRet;
336}
337
338void SAL_CALL ScHeaderFooterTextObj::setString( const OUString& aText )
339{
340 SolarMutexGuard aGuard;
341
342 // for pure text, no font info is needed in pool defaults
344 aEditEngine.SetTextCurrentDefaults( aText );
345 aTextData.UpdateData(aEditEngine);
346}
347
348void SAL_CALL ScHeaderFooterTextObj::insertString( const uno::Reference<text::XTextRange>& xRange,
349 const OUString& aString, sal_Bool bAbsorb )
350{
351 SolarMutexGuard aGuard;
352 if (!mxUnoText.is())
354 mxUnoText->insertString( xRange, aString, bAbsorb );
355}
356
358 const uno::Reference<text::XTextRange>& xRange,
359 sal_Int16 nControlCharacter, sal_Bool bAbsorb )
360{
361 SolarMutexGuard aGuard;
362 if (!mxUnoText.is())
364 mxUnoText->insertControlCharacter( xRange, nControlCharacter, bAbsorb );
365}
366
368 const uno::Reference<text::XTextRange >& xRange,
369 const uno::Reference<text::XTextContent >& xContent,
370 sal_Bool bAbsorb )
371{
372 SolarMutexGuard aGuard;
373 if ( xContent.is() && xRange.is() )
374 {
375 ScEditFieldObj* pHeaderField = comphelper::getFromUnoTunnel<ScEditFieldObj>( xContent );
376
377 SvxUnoTextRangeBase* pTextRange =
378 comphelper::getFromUnoTunnel<ScHeaderFooterTextCursor>( xRange );
379
380 if ( pHeaderField && !pHeaderField->IsInserted() && pTextRange )
381 {
382 SvxEditSource* pEditSource = pTextRange->GetEditSource();
383 ESelection aSelection(pTextRange->GetSelection());
384
385 if (!bAbsorb)
386 {
387 // don't replace -> append at end
388 aSelection.Adjust();
389 aSelection.nStartPara = aSelection.nEndPara;
390 aSelection.nStartPos = aSelection.nEndPos;
391 }
392
393 SvxFieldItem aItem(pHeaderField->CreateFieldItem());
394
395 SvxTextForwarder* pForwarder = pEditSource->GetTextForwarder();
396 pForwarder->QuickInsertField( aItem, aSelection );
397 pEditSource->UpdateData();
398
399 // new selection: a digit
400 aSelection.Adjust();
401 aSelection.nEndPara = aSelection.nStartPara;
402 aSelection.nEndPos = aSelection.nStartPos + 1;
403
404 uno::Reference<text::XTextRange> xTextRange;
405 switch ( aTextData.GetPart() )
406 {
408 xTextRange = aTextData.GetContentObj()->getLeftText();
409 break;
411 xTextRange = aTextData.GetContentObj()->getCenterText();
412 break;
414 xTextRange = aTextData.GetContentObj()->getRightText();
415 break;
416 }
417
418 pHeaderField->InitDoc(xTextRange, std::make_unique<ScHeaderFooterEditSource>(aTextData), aSelection);
419
420 // for bAbsorb=FALSE, the new selection must be behind the inserted content
421 // (the xml filter relies on this)
422 if (!bAbsorb)
423 aSelection.nStartPos = aSelection.nEndPos;
424
425 pTextRange->SetSelection( aSelection );
426
427 return;
428 }
429 }
430
431 if (!mxUnoText.is())
433 mxUnoText->insertTextContent( xRange, xContent, bAbsorb );
434}
435
437 const uno::Reference<text::XTextContent>& xContent )
438{
439 SolarMutexGuard aGuard;
440 if ( xContent.is() )
441 {
442 ScEditFieldObj* pHeaderField = comphelper::getFromUnoTunnel<ScEditFieldObj>(xContent);
443 if ( pHeaderField && pHeaderField->IsInserted() )
444 {
446 pHeaderField->DeleteField();
447 return;
448 }
449 }
450 if (!mxUnoText.is())
452 mxUnoText->removeTextContent( xContent );
453}
454
455uno::Reference<text::XText> SAL_CALL ScHeaderFooterTextObj::getText()
456{
457 SolarMutexGuard aGuard;
458 if (!mxUnoText.is())
460 return mxUnoText->getText();
461}
462
463uno::Reference<text::XTextRange> SAL_CALL ScHeaderFooterTextObj::getStart()
464{
465 SolarMutexGuard aGuard;
466 if (!mxUnoText.is())
468 return mxUnoText->getStart();
469}
470
471uno::Reference<text::XTextRange> SAL_CALL ScHeaderFooterTextObj::getEnd()
472{
473 SolarMutexGuard aGuard;
474 if (!mxUnoText.is())
476 return mxUnoText->getEnd();
477}
478
479// XTextFieldsSupplier
480
481uno::Reference<container::XEnumerationAccess> SAL_CALL ScHeaderFooterTextObj::getTextFields()
482{
483 SolarMutexGuard aGuard;
484 // all fields
485 return new ScHeaderFieldsObj(aTextData);
486}
487
488uno::Reference<container::XNameAccess> SAL_CALL ScHeaderFooterTextObj::getTextFieldMasters()
489{
490 // this does not exists in Calc (?)
491 return nullptr;
492}
493
494// XTextRangeMover
495
497 const uno::Reference<text::XTextRange>& xRange,
498 sal_Int16 nParagraphs )
499{
500 SolarMutexGuard aGuard;
501 if (!mxUnoText.is())
503 mxUnoText->moveTextRange( xRange, nParagraphs );
504}
505
506// XEnumerationAccess
507
508uno::Reference<container::XEnumeration> SAL_CALL ScHeaderFooterTextObj::createEnumeration()
509{
510 SolarMutexGuard aGuard;
511 if (!mxUnoText.is())
513 return mxUnoText->createEnumeration();
514}
515
516// XElementAccess
517
519{
520 SolarMutexGuard aGuard;
521 if (!mxUnoText.is())
523 return mxUnoText->getElementType();
524}
525
527{
528 SolarMutexGuard aGuard;
529 if (!mxUnoText.is())
531 return mxUnoText->hasElements();
532}
533
535 SvxUnoTextCursor( rText.GetUnoText() ),
536 mxTextObj( &rText )
537{
538}
539
541{
542}
543
544// SvxUnoTextCursor methods reimplemented here to return the right objects:
545
546uno::Reference<text::XText> SAL_CALL ScCellTextCursor::getText()
547{
548 return mxTextObj;
549}
550
551uno::Reference<text::XTextRange> SAL_CALL ScCellTextCursor::getStart()
552{
553 SolarMutexGuard aGuard;
554
556
558
559 ESelection aNewSel(GetSelection());
560 aNewSel.nEndPara = aNewSel.nStartPara;
561 aNewSel.nEndPos = aNewSel.nStartPos;
562 pNew->SetSelection( aNewSel );
563
564 return static_cast<SvxUnoTextRangeBase*>(pNew.get());
565}
566
567uno::Reference<text::XTextRange> SAL_CALL ScCellTextCursor::getEnd()
568{
569 SolarMutexGuard aGuard;
570
572
574
575 ESelection aNewSel(GetSelection());
576 aNewSel.nStartPara = aNewSel.nEndPara;
577 aNewSel.nStartPos = aNewSel.nEndPos;
578 pNew->SetSelection( aNewSel );
579
580 return static_cast<SvxUnoTextRangeBase*>(pNew.get());
581}
582
583// XUnoTunnel
584
586
588 SvxUnoTextCursor( rText->GetUnoText() ),
589 rTextObj( rText )
590{}
591
593
594// SvxUnoTextCursor methods reimplemented here to return the right objects:
595
596uno::Reference<text::XText> SAL_CALL ScHeaderFooterTextCursor::getText()
597{
598 SolarMutexGuard aGuard;
599 return rTextObj;
600}
601
602uno::Reference<text::XTextRange> SAL_CALL ScHeaderFooterTextCursor::getStart()
603{
604 SolarMutexGuard aGuard;
605
607
609
610 ESelection aNewSel(GetSelection());
611 aNewSel.nEndPara = aNewSel.nStartPara;
612 aNewSel.nEndPos = aNewSel.nStartPos;
613 pNew->SetSelection( aNewSel );
614
615 return static_cast<SvxUnoTextRangeBase*>(pNew.get());
616}
617
618uno::Reference<text::XTextRange> SAL_CALL ScHeaderFooterTextCursor::getEnd()
619{
620 SolarMutexGuard aGuard;
621
623
625
626 ESelection aNewSel(GetSelection());
627 aNewSel.nStartPara = aNewSel.nEndPara;
628 aNewSel.nStartPos = aNewSel.nEndPos;
629 pNew->SetSelection( aNewSel );
630
631 return static_cast<SvxUnoTextRangeBase*>(pNew.get());
632}
633
634// XUnoTunnel
635
637
638ScDrawTextCursor::ScDrawTextCursor( uno::Reference<text::XText> xParent,
639 const SvxUnoTextBase& rText ) :
640 SvxUnoTextCursor( rText ),
641 xParentText(std::move( xParent ))
642
643{
644}
645
647{
648}
649
650// SvxUnoTextCursor methods reimplemented here to return the right objects:
651
652uno::Reference<text::XText> SAL_CALL ScDrawTextCursor::getText()
653{
654 SolarMutexGuard aGuard;
655 return xParentText;
656}
657
658uno::Reference<text::XTextRange> SAL_CALL ScDrawTextCursor::getStart()
659{
660 SolarMutexGuard aGuard;
661
663
665
666 ESelection aNewSel(GetSelection());
667 aNewSel.nEndPara = aNewSel.nStartPara;
668 aNewSel.nEndPos = aNewSel.nStartPos;
669 pNew->SetSelection( aNewSel );
670
671 return static_cast<SvxUnoTextRangeBase*>(pNew.get());
672}
673
674uno::Reference<text::XTextRange> SAL_CALL ScDrawTextCursor::getEnd()
675{
676 SolarMutexGuard aGuard;
677
679
681
682 ESelection aNewSel(GetSelection());
683 aNewSel.nStartPara = aNewSel.nEndPara;
684 aNewSel.nStartPos = aNewSel.nEndPos;
685 pNew->SetSelection( aNewSel );
686
687 return static_cast<SvxUnoTextRangeBase*>(pNew.get());
688}
689
690// XUnoTunnel
691
693
695{
697 pEnginePool->SetDefaultMetric( MapUnit::Map100thMM );
698 pEnginePool->FreezeIdRanges();
699
700 pEditEngine.reset( new ScFieldEditEngine(nullptr, pEnginePool.get(), nullptr, true) ); // TRUE: become owner of pool
702 pOriginalSource.reset( new ScSimpleEditSource( pForwarder.get() ) );
703}
704
706{
707 SolarMutexGuard aGuard; // needed for EditEngine dtor
708
709 pOriginalSource.reset();
710 pForwarder.reset();
711 pEditEngine.reset();
712}
713
715 SvxUnoText( GetOriginalSource(), ScCellObj::GetEditPropertySet(), uno::Reference<text::XText>() )
716{
717}
718
720{
721}
722
724{
725 GetEditEngine()->SetTextCurrentDefaults( rTextObject );
726
727 ESelection aSel;
728 ::GetSelection( aSel, GetEditSource()->GetTextForwarder() );
729 SetSelection( aSel );
730}
731
732std::unique_ptr<EditTextObject> ScEditEngineTextObj::CreateTextObject()
733{
735}
736
738 pDocShell( pDocSh ),
739 aCellPos( rP ),
740 bDataValid( false ),
741 bInUpdate( false ),
742 bDirty( false ),
743 bDoUpdate( true )
744{
745 if (pDocShell)
747}
748
750{
751 SolarMutexGuard aGuard; // needed for EditEngine dtor
752
753 if (pDocShell)
754 {
757 }
758 else
759 pEditEngine.reset();
760
761 pForwarder.reset();
762
763 pOriginalSource.reset();
764}
765
767{
768 if (!pOriginalSource)
770 return pOriginalSource.get();
771}
772
774{
775 if (!pEditEngine)
776 {
777 if ( pDocShell )
778 {
781 }
782 else
783 {
785 pEnginePool->FreezeIdRanges();
786 pEditEngine.reset( new ScFieldEditEngine(nullptr, pEnginePool.get(), nullptr, true) );
787 }
788 // currently, GetPortions doesn't work if UpdateMode is sal_False,
789 // this will be fixed (in EditEngine) by src600
790// pEditEngine->SetUpdateMode( sal_False );
791 pEditEngine->EnableUndo( false );
792 if (pDocShell)
793 pEditEngine->SetRefDevice(pDocShell->GetRefDevice());
794 else
795 pEditEngine->SetRefMapMode(MapMode(MapUnit::Map100thMM));
797 }
798
799 if (bDataValid)
800 return pForwarder.get();
801
802 if (pDocShell)
803 {
805
806 SfxItemSet aDefaults( pEditEngine->GetEmptyItemSet() );
807 if( const ScPatternAttr* pPattern =
808 rDoc.GetPattern( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab() ) )
809 {
810 pPattern->FillEditItemSet( &aDefaults );
811 pPattern->FillEditParaItems( &aDefaults ); // including alignment etc. (for reading)
812 }
813
814 ScRefCellValue aCell(rDoc, aCellPos);
815 if (aCell.getType() == CELLTYPE_EDIT)
816 {
817 const EditTextObject* pObj = aCell.getEditText();
818 pEditEngine->SetTextNewDefaults(*pObj, aDefaults);
819 }
820 else
821 {
822 sal_uInt32 nFormat = rDoc.GetNumberFormat(aCellPos);
823 OUString aText = ScCellFormat::GetInputString(aCell, nFormat, *rDoc.GetFormatTable(), rDoc);
824 if (!aText.isEmpty())
825 pEditEngine->SetTextNewDefaults(aText, aDefaults);
826 else
827 pEditEngine->SetDefaults(aDefaults);
828 }
829 }
830
831 bDataValid = true;
832 return pForwarder.get();
833}
834
836{
837 if ( bDoUpdate )
838 {
839 OSL_ENSURE(pEditEngine != nullptr, "no EditEngine for UpdateData()");
840 if ( pDocShell && pEditEngine )
841 {
842 // during the own UpdateData call, bDataValid must not be reset,
843 // or things like attributes after the text would be lost
844 // (are not stored in the cell)
845 bInUpdate = true; // prevents bDataValid from being reset
846 pDocShell->GetDocFunc().PutData(aCellPos, *pEditEngine, true); // always as text
847
848 bInUpdate = false;
849 bDirty = false;
850 }
851 }
852 else
853 bDirty = true;
854}
855
857{
858 const SfxHintId nId = rHint.GetId();
859 if ( nId == SfxHintId::Dying )
860 {
861 pDocShell = nullptr; // invalid now
862
863 pForwarder.reset();
864 pEditEngine.reset(); // EditEngine uses document's pool
865 }
866 else if ( nId == SfxHintId::DataChanged )
867 {
868 if (!bInUpdate) // not for own UpdateData calls
869 bDataValid = false; // text has to be read from the cell again
870 }
871}
872
874 ScCellTextData( pDocSh, rP ),
875 SvxUnoText( GetOriginalSource(), ScCellObj::GetEditPropertySet(), uno::Reference<text::XText>() )
876{
877}
878
879ScCellTextObj::~ScCellTextObj() COVERITY_NOEXCEPT_FALSE
880{
881}
882
883/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< EditTextObject > CreateTextObject()
static rtl::Reference< SfxItemPool > CreatePool()
SCTAB Tab() const
Definition: address.hxx:283
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
Data (incl.
Definition: editsrc.hxx:74
static OUString GetInputString(const ScRefCellValue &rCell, sal_uInt32 nFormat, SvNumberFormatter &rFormatter, const ScDocument &rDoc, const svl::SharedString **pShared=nullptr, bool bFiltering=false, bool bForceSystemLocale=false)
Definition: cellform.cxx:129
really derive cell from range?
Definition: cellsuno.hxx:645
uno3: SvxUnoTextCursor is not derived from XUnoTunnel, but should be (?)
Definition: textuno.hxx:216
rtl::Reference< ScCellObj > mxTextObj
Definition: textuno.hxx:217
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
Definition: textuno.cxx:567
ScCellTextCursor(ScCellObj &rText)
Definition: textuno.cxx:534
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
Definition: textuno.cxx:546
virtual ~ScCellTextCursor() noexcept override
Definition: textuno.cxx:540
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
Definition: textuno.cxx:551
ScDocShell * pDocShell
Definition: textuno.hxx:329
ScCellEditSource * GetOriginalSource()
Definition: textuno.cxx:766
std::unique_ptr< ScCellEditSource > pOriginalSource
Definition: textuno.hxx:333
std::unique_ptr< ScFieldEditEngine > pEditEngine
Definition: textuno.hxx:331
std::unique_ptr< SvxEditEngineForwarder > pForwarder
Definition: textuno.hxx:332
virtual SvxTextForwarder * GetTextForwarder()
Definition: textuno.cxx:773
virtual ~ScCellTextData() override
Definition: textuno.cxx:749
ScCellTextData(ScDocShell *pDocSh, const ScAddress &rP)
Definition: textuno.cxx:737
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: textuno.cxx:856
ScAddress aCellPos
Definition: textuno.hxx:330
void UpdateData()
Definition: textuno.cxx:835
ScCellTextObj(ScDocShell *pDocSh, const ScAddress &rP)
Definition: textuno.cxx:873
virtual ~ScCellTextObj() COVERITY_NOEXCEPT_FALSE override
Definition: textuno.cxx:879
void PutData(const ScAddress &rPos, ScEditEngineDefaulter &rEngine, bool bApi)
Definition: docfunc.cxx:1160
OutputDevice * GetRefDevice()
Definition: docsh3.cxx:466
const ScDocument & GetDocument() const
Definition: docsh.hxx:220
ScDocFunc & GetDocFunc()
Definition: docsh.hxx:222
SC_DLLPUBLIC sal_uInt32 GetNumberFormat(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:3685
void AddUnoObject(SfxListener &rObject)
Definition: documen3.cxx:907
std::unique_ptr< ScFieldEditEngine > CreateFieldEditEngine()
Definition: documen2.cxx:1144
void DisposeFieldEditEngine(std::unique_ptr< ScFieldEditEngine > &rpEditEngine)
Definition: documen2.cxx:1166
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:461
void RemoveUnoObject(SfxListener &rObject)
Definition: documen3.cxx:915
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4812
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
Definition: textuno.cxx:658
virtual ~ScDrawTextCursor() noexcept override
Definition: textuno.cxx:646
ScDrawTextCursor(css::uno::Reference< css::text::XText > xParent, const SvxUnoTextBase &rText)
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
Definition: textuno.cxx:674
css::uno::Reference< css::text::XText > xParentText
Definition: textuno.hxx:271
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
Definition: textuno.cxx:652
void SetTextCurrentDefaults(const EditTextObject &rTextObject)
SetText and apply defaults already set.
Definition: editutil.cxx:616
std::unique_ptr< EditTextObject > CreateTextObject()
Definition: textuno.cxx:732
void SetText(const EditTextObject &rTextObject)
Definition: textuno.cxx:723
virtual ~ScEditEngineTextObj() noexcept override
Definition: textuno.cxx:719
void InitDoc(const css::uno::Reference< css::text::XTextRange > &rContent, std::unique_ptr< ScEditSource > pEditSrc, const ESelection &rSel)
Definition: fielduno.cxx:1064
void DeleteField()
Definition: fielduno.cxx:1087
SvxFieldItem CreateFieldItem()
Definition: fielduno.cxx:1081
bool IsInserted() const
Definition: fielduno.cxx:1103
static OUString GetSpaceDelimitedString(const EditEngine &rEngine)
Retrieves string with paragraphs delimited by spaces.
Definition: editutil.cxx:105
void SetData(const ScHeaderFieldData &rNew)
Definition: editutil.hxx:224
rtl::Reference< ScHeaderFooterTextObj > mxRightText
Definition: textuno.hxx:63
virtual css::uno::Reference< css::text::XText > SAL_CALL getLeftText() override
Definition: textuno.cxx:109
virtual css::uno::Reference< css::text::XText > SAL_CALL getCenterText() override
Definition: textuno.cxx:116
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: textuno.cxx:132
static rtl::Reference< ScHeaderFooterContentObj > getImplementation(const css::uno::Reference< css::sheet::XHeaderFooterContent > &rObj)
Definition: textuno.cxx:144
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: textuno.cxx:138
const EditTextObject * GetLeftEditObject() const
Definition: textuno.cxx:92
virtual ~ScHeaderFooterContentObj() override
Definition: textuno.cxx:90
rtl::Reference< ScHeaderFooterTextObj > mxCenterText
Definition: textuno.hxx:62
void Init(const EditTextObject *pLeft, const EditTextObject *pCenter, const EditTextObject *pRight)
Definition: textuno.cxx:150
const EditTextObject * GetCenterEditObject() const
Definition: textuno.cxx:97
virtual css::uno::Reference< css::text::XText > SAL_CALL getRightText() override
Definition: textuno.cxx:123
const EditTextObject * GetRightEditObject() const
Definition: textuno.cxx:102
rtl::Reference< ScHeaderFooterTextObj > mxLeftText
Definition: textuno.hxx:61
ScHeaderFooterTextObj keeps the authoritative copy of ScHeaderFooterTextData that this class holds re...
Definition: editsrc.hxx:50
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
Definition: textuno.cxx:602
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
Definition: textuno.cxx:596
ScHeaderFooterTextCursor(rtl::Reference< ScHeaderFooterTextObj > const &rText)
Definition: textuno.cxx:587
virtual ~ScHeaderFooterTextCursor() noexcept override
Definition: textuno.cxx:592
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
Definition: textuno.cxx:618
rtl::Reference< ScHeaderFooterTextObj > rTextObj
Definition: textuno.hxx:245
ScHeaderFooterTextData(const ScHeaderFooterTextData &)=delete
ScHeaderFooterPart GetPart() const
Definition: textuno.hxx:125
std::unique_ptr< EditTextObject > mpTextObj
Definition: textuno.hxx:105
const EditTextObject * GetTextObject() const
Definition: textuno.hxx:128
std::unique_ptr< SvxEditEngineForwarder > pForwarder
Definition: textuno.hxx:109
std::unique_ptr< ScEditEngineDefaulter > pEditEngine
Definition: textuno.hxx:108
css::uno::Reference< css::sheet::XHeaderFooterContent > GetContentObj() const
Definition: textuno.hxx:126
SvxTextForwarder * GetTextForwarder()
Definition: textuno.cxx:177
Each of these instances represent, the left, center or right part of the header of footer of a page.
Definition: textuno.hxx:143
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > &aTextPosition) override
Definition: textuno.cxx:273
virtual void SAL_CALL removeTextContent(const css::uno::Reference< css::text::XTextContent > &xContent) override
Definition: textuno.cxx:436
virtual void SAL_CALL moveTextRange(const css::uno::Reference< css::text::XTextRange > &xRange, sal_Int16 nParagraphs) override
Definition: textuno.cxx:496
virtual void SAL_CALL setString(const OUString &aString) override
Definition: textuno.cxx:338
const EditTextObject * GetTextObject() const
Definition: textuno.cxx:253
virtual void SAL_CALL insertTextContent(const css::uno::Reference< css::text::XTextRange > &xRange, const css::uno::Reference< css::text::XTextContent > &xContent, sal_Bool bAbsorb) override
Definition: textuno.cxx:367
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override
Definition: textuno.cxx:267
virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getTextFields() override
Definition: textuno.cxx:481
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextFieldMasters() override
Definition: textuno.cxx:488
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
Definition: textuno.cxx:455
static void FillDummyFieldData(ScHeaderFieldData &rData)
Definition: textuno.cxx:283
const SvxUnoText & GetUnoText()
Definition: textuno.cxx:258
virtual ~ScHeaderFooterTextObj() override
Definition: textuno.cxx:251
virtual void SAL_CALL insertString(const css::uno::Reference< css::text::XTextRange > &xRange, const OUString &aString, sal_Bool bAbsorb) override
Definition: textuno.cxx:348
virtual css::uno::Type SAL_CALL getElementType() override
Definition: textuno.cxx:518
rtl::Reference< SvxUnoText > mxUnoText
Definition: textuno.hxx:146
virtual OUString SAL_CALL getString() override
Definition: textuno.cxx:294
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: textuno.cxx:508
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
Definition: textuno.cxx:463
virtual void SAL_CALL insertControlCharacter(const css::uno::Reference< css::text::XTextRange > &xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb) override
Definition: textuno.cxx:357
ScHeaderFooterTextObj(const css::uno::WeakReference< css::sheet::XHeaderFooterContent > &xContent, ScHeaderFooterPart nP, const EditTextObject *pTextObj)
Definition: textuno.cxx:233
virtual sal_Bool SAL_CALL hasElements() override
Definition: textuno.cxx:526
ScHeaderFooterTextData aTextData
Definition: textuno.hxx:145
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
Definition: textuno.cxx:471
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
Definition: patattr.hxx:72
void FillEditItemSet(SfxItemSet *pEditSet, const SfxItemSet *pCondSet=nullptr) const
Converts all Calc items contained in the own item set to edit engine items and puts them into pEditSe...
Definition: patattr.cxx:827
std::unique_ptr< SvxEditEngineForwarder > pForwarder
Definition: textuno.hxx:303
ScEditEngineDefaulter * GetEditEngine() const
Definition: textuno.hxx:311
std::unique_ptr< ScSimpleEditSource > pOriginalSource
Definition: textuno.hxx:304
std::unique_ptr< ScEditEngineDefaulter > pEditEngine
Definition: textuno.hxx:302
static SdrItemPool & GetGlobalDrawObjectItemPool()
SfxHintId GetId() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
std::unique_ptr< SfxPoolItem > CloneSetWhich(sal_uInt16 nNewWhich) const
virtual SvxTextForwarder * GetTextForwarder()=0
virtual void UpdateData()=0
virtual void QuickInsertField(const SvxFieldItem &rFld, const ESelection &rSel)=0
const ESelection & GetSelection() const noexcept
SvxEditSource * GetEditSource() const noexcept
void SetSelection(const ESelection &rSelection) noexcept
const css::uno::Sequence< sal_Int8 > & getSeq() const
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
@ CELLTYPE_EDIT
Definition: global.hxx:276
SfxHintId
#define SAL_WARN(area, stream)
#define MID_FONTHEIGHT
std::unique_ptr< sal_Int32[]> pData
#define SC_SIMPLE_SERVICE_INFO(ClassName, ClassNameAscii, ServiceAscii)
Definition: miscuno.hxx:63
def text(shape, orig_st)
constexpr OUStringLiteral aData
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
Reference
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
sal_Int16 nId
#define CONVERT_TWIPS
constexpr TypedWhichId< SvxFontHeightItem > ATTR_FONT_HEIGHT(101)
constexpr TypedWhichId< ScPatternAttr > ATTR_PATTERN(156)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CJK_FONT_HEIGHT(112)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CTL_FONT_HEIGHT(117)
#define SC_MOD()
Definition: scmod.hxx:249
sal_Int32 nStartPara
sal_Int32 nEndPos
sal_Int32 nStartPos
void Adjust()
sal_Int32 nEndPara
OUString aLongDocName
Definition: editutil.hxx:202
tools::Long nPageNo
Definition: editutil.hxx:206
OUString aShortDocName
Definition: editutil.hxx:203
OUString aTabName
Definition: editutil.hxx:204
tools::Long nTotalPages
Definition: editutil.hxx:207
This is very similar to ScCellValue, except that it references the original value instead of copying ...
Definition: cellvalue.hxx:108
const EditTextObject * getEditText() const
Definition: cellvalue.hxx:136
CellType getType() const
Definition: cellvalue.hxx:133
UNO3_GETIMPLEMENTATION2_IMPL(ScCellTextCursor, SvxUnoTextCursor)
static const SvxItemPropertySet * lcl_GetHdFtPropertySet()
Definition: textuno.cxx:53
ScHeaderFooterPart
Definition: textuno.hxx:50
unsigned char sal_Bool
#define SVX_UNOEDIT_CHAR_PROPERTIES
#define SVX_UNOEDIT_NUMBERING_PROPERTY
#define SVX_UNOEDIT_PARA_PROPERTIES
#define SVX_UNOEDIT_FONT_PROPERTIES