LibreOffice Module sc (master)  1
fielduno.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 <fielduno.hxx>
22 #include <textuno.hxx>
23 #include <miscuno.hxx>
24 #include <docsh.hxx>
25 #include <hints.hxx>
26 #include <editsrc.hxx>
27 #include <unonames.hxx>
28 #include <editutil.hxx>
29 
30 #include <svl/hint.hxx>
31 #include <vcl/svapp.hxx>
32 
33 #include <editeng/eeitem.hxx>
34 
35 #include <editeng/editeng.hxx>
36 #include <editeng/editobj.hxx>
37 #include <editeng/flditem.hxx>
38 #include <comphelper/sequence.hxx>
40 
41 #include <com/sun/star/beans/PropertyAttribute.hpp>
42 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
43 #include <com/sun/star/text/TextContentAnchorType.hpp>
44 #include <com/sun/star/text/WrapTextMode.hpp>
45 #include <com/sun/star/text/FilenameDisplayFormat.hpp>
46 #include <com/sun/star/text/textfield/Type.hpp>
47 
48 using namespace com::sun::star;
49 
50 namespace {
51 
52 // no Which-ID here, map only for PropertySetInfo
53 
54 const SfxItemPropertySet* getDateTimePropertySet()
55 {
56  static const SfxItemPropertyMapEntry aMapContent[] =
57  {
59  { OUString(SC_UNONAME_ISFIXED), 0, cppu::UnoType<bool>::get(), 0, 0 },
60  { OUString(SC_UNONAME_ISDATE), 0, cppu::UnoType<bool>::get(), 0, 0 },
61  { OUString(SC_UNONAME_NUMFMT), 0, cppu::UnoType<sal_Int32>::get(), 0, 0 },
62  { OUString(), 0, css::uno::Type(), 0, 0 }
63  };
64  static SfxItemPropertySet aMap(aMapContent);
65  return &aMap;
66 }
67 
68 const SfxItemPropertySet* getEmptyPropertySet()
69 {
70  static const SfxItemPropertyMapEntry aMapContent[] =
71  {
72  { OUString(), 0, css::uno::Type(), 0, 0 }
73  };
74  static SfxItemPropertySet aMap(aMapContent);
75  return &aMap;
76 }
77 
78 const SfxItemPropertySet* lcl_GetURLPropertySet()
79 {
80  static const SfxItemPropertyMapEntry aURLPropertyMap_Impl[] =
81  {
82  {OUString(SC_UNONAME_ANCTYPE), 0, cppu::UnoType<text::TextContentAnchorType>::get(), beans::PropertyAttribute::READONLY, 0 },
83  {OUString(SC_UNONAME_ANCTYPES), 0, cppu::UnoType<uno::Sequence<text::TextContentAnchorType>>::get(), beans::PropertyAttribute::READONLY, 0 },
84  {OUString(SC_UNONAME_REPR), 0, cppu::UnoType<OUString>::get(), 0, 0},
85  {OUString(SC_UNONAME_TARGET), 0, cppu::UnoType<OUString>::get(), 0, 0},
86  {OUString(SC_UNONAME_TEXTWRAP), 0, cppu::UnoType<text::WrapTextMode>::get(), beans::PropertyAttribute::READONLY, 0 },
87  {OUString(SC_UNONAME_URL), 0, cppu::UnoType<OUString>::get(), 0, 0},
88  { OUString(), 0, css::uno::Type(), 0, 0 }
89  };
90  static SfxItemPropertySet aURLPropertySet_Impl( aURLPropertyMap_Impl );
91  return &aURLPropertySet_Impl;
92 }
93 
94 const SfxItemPropertySet* lcl_GetHeaderFieldPropertySet()
95 {
96  static const SfxItemPropertyMapEntry aHeaderFieldPropertyMap_Impl[] =
97  {
98  {OUString(SC_UNONAME_ANCTYPE), 0, cppu::UnoType<text::TextContentAnchorType>::get(), beans::PropertyAttribute::READONLY, 0 },
99  {OUString(SC_UNONAME_ANCTYPES), 0, cppu::UnoType<uno::Sequence<text::TextContentAnchorType>>::get(), beans::PropertyAttribute::READONLY, 0 },
100  {OUString(SC_UNONAME_TEXTWRAP), 0, cppu::UnoType<text::WrapTextMode>::get(), beans::PropertyAttribute::READONLY, 0 },
101  { OUString(), 0, css::uno::Type(), 0, 0 }
102  };
103  static SfxItemPropertySet aHeaderFieldPropertySet_Impl( aHeaderFieldPropertyMap_Impl );
104  return &aHeaderFieldPropertySet_Impl;
105 }
106 
107 const SfxItemPropertySet* lcl_GetFileFieldPropertySet()
108 {
109  static const SfxItemPropertyMapEntry aFileFieldPropertyMap_Impl[] =
110  {
111  {OUString(SC_UNONAME_ANCTYPE), 0, cppu::UnoType<text::TextContentAnchorType>::get(), beans::PropertyAttribute::READONLY, 0 },
112  {OUString(SC_UNONAME_ANCTYPES), 0, cppu::UnoType<uno::Sequence<text::TextContentAnchorType>>::get(), beans::PropertyAttribute::READONLY, 0 },
113  {OUString(SC_UNONAME_FILEFORM), 0, cppu::UnoType<sal_Int16>::get(), 0, 0 },
114  {OUString(SC_UNONAME_TEXTWRAP), 0, cppu::UnoType<text::WrapTextMode>::get(), beans::PropertyAttribute::READONLY, 0 },
115  { OUString(), 0, css::uno::Type(), 0, 0 }
116  };
117  static SfxItemPropertySet aFileFieldPropertySet_Impl( aFileFieldPropertyMap_Impl );
118  return &aFileFieldPropertySet_Impl;
119 }
120 
121 SvxFileFormat lcl_UnoToSvxFileFormat( sal_Int16 nUnoValue )
122 {
123  switch( nUnoValue )
124  {
125  case text::FilenameDisplayFormat::FULL: return SvxFileFormat::PathFull;
126  case text::FilenameDisplayFormat::PATH: return SvxFileFormat::PathOnly;
127  case text::FilenameDisplayFormat::NAME: return SvxFileFormat::NameOnly;
128  default:
129  return SvxFileFormat::NameAndExt;
130  }
131 }
132 
133 sal_Int16 lcl_SvxToUnoFileFormat( SvxFileFormat nSvxValue )
134 {
135  switch( nSvxValue )
136  {
137  case SvxFileFormat::NameAndExt: return text::FilenameDisplayFormat::NAME_AND_EXT;
138  case SvxFileFormat::PathFull: return text::FilenameDisplayFormat::FULL;
139  case SvxFileFormat::PathOnly: return text::FilenameDisplayFormat::PATH;
140  default:
141  return text::FilenameDisplayFormat::NAME;
142  }
143 }
144 
145 }
146 
147 SC_SIMPLE_SERVICE_INFO( ScCellFieldsObj, "ScCellFieldsObj", "com.sun.star.text.TextFields" )
148 SC_SIMPLE_SERVICE_INFO( ScHeaderFieldsObj, "ScHeaderFieldsObj", "com.sun.star.text.TextFields" )
149 
150 namespace {
151 
153 {
154  SC_UNO_COLLECT_NONE,
155  SC_UNO_COLLECT_COUNT,
156  SC_UNO_COLLECT_FINDINDEX,
157  SC_UNO_COLLECT_FINDPOS
158 };
159 
165 class ScUnoEditEngine : public ScEditEngineDefaulter
166 {
168  sal_uInt16 nFieldCount;
169  sal_Int32 mnFieldType;
170  std::unique_ptr<SvxFieldData>
171  pFound; // local copy
172  sal_Int32 nFieldPar;
173  sal_Int32 nFieldPos;
174  sal_uInt16 nFieldIndex;
175 
176 public:
177  explicit ScUnoEditEngine(ScEditEngineDefaulter* pSource);
178 
179  virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos,
180  std::optional<Color>& rTxtColor, std::optional<Color>& rFldColor ) override;
181 
182  sal_uInt16 CountFields();
183  SvxFieldData* FindByIndex(sal_uInt16 nIndex);
184  SvxFieldData* FindByPos(sal_Int32 nPar, sal_Int32 nPos, sal_Int32 nType);
185 
186  sal_Int32 GetFieldPar() const { return nFieldPar; }
187  sal_Int32 GetFieldPos() const { return nFieldPos; }
188 };
189 
190 }
191 
192 ScUnoEditEngine::ScUnoEditEngine(ScEditEngineDefaulter* pSource)
193  : ScEditEngineDefaulter(*pSource)
194  , eMode(SC_UNO_COLLECT_NONE)
195  , nFieldCount(0)
196  , mnFieldType(text::textfield::Type::UNSPECIFIED)
197  , nFieldPar(0)
198  , nFieldPos(0)
199  , nFieldIndex(0)
200 {
201  std::unique_ptr<EditTextObject> pData = pSource->CreateTextObject();
202  SetTextCurrentDefaults( *pData );
203 }
204 
205 OUString ScUnoEditEngine::CalcFieldValue( const SvxFieldItem& rField,
206  sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rTxtColor, std::optional<Color>& rFldColor )
207 {
208  OUString aRet(EditEngine::CalcFieldValue( rField, nPara, nPos, rTxtColor, rFldColor ));
209  if (eMode != SC_UNO_COLLECT_NONE)
210  {
211  const SvxFieldData* pFieldData = rField.GetField();
212  if ( pFieldData )
213  {
214  if (mnFieldType == text::textfield::Type::UNSPECIFIED || pFieldData->GetClassId() == mnFieldType)
215  {
216  if ( eMode == SC_UNO_COLLECT_FINDINDEX && !pFound && nFieldCount == nFieldIndex )
217  {
218  pFound = pFieldData->Clone();
219  nFieldPar = nPara;
220  nFieldPos = nPos;
221  }
222  if ( eMode == SC_UNO_COLLECT_FINDPOS && !pFound &&
223  nPara == nFieldPar && nPos == nFieldPos )
224  {
225  pFound = pFieldData->Clone();
226  nFieldIndex = nFieldCount;
227  }
228  ++nFieldCount;
229  }
230  }
231  }
232  return aRet;
233 }
234 
235 sal_uInt16 ScUnoEditEngine::CountFields()
236 {
237  eMode = SC_UNO_COLLECT_COUNT;
238  mnFieldType = text::textfield::Type::UNSPECIFIED;
239  nFieldCount = 0;
240  UpdateFields();
241  eMode = SC_UNO_COLLECT_NONE;
242 
243  return nFieldCount;
244 }
245 
246 SvxFieldData* ScUnoEditEngine::FindByIndex(sal_uInt16 nIndex)
247 {
248  eMode = SC_UNO_COLLECT_FINDINDEX;
249  nFieldIndex = nIndex;
250  mnFieldType = text::textfield::Type::UNSPECIFIED;
251  nFieldCount = 0;
252  UpdateFields();
253  eMode = SC_UNO_COLLECT_NONE;
254 
255  return pFound.get();
256 }
257 
258 SvxFieldData* ScUnoEditEngine::FindByPos(sal_Int32 nPar, sal_Int32 nPos, sal_Int32 nType)
259 {
260  eMode = SC_UNO_COLLECT_FINDPOS;
261  nFieldPar = nPar;
262  nFieldPos = nPos;
263  mnFieldType = nType;
264  nFieldCount = 0;
265  UpdateFields();
266  mnFieldType = text::textfield::Type::UNSPECIFIED;
267  eMode = SC_UNO_COLLECT_NONE;
268 
269  return pFound.get();
270 }
271 
273  const uno::Reference<text::XTextRange>& xContent,
274  ScDocShell* pDocSh, const ScAddress& rPos) :
275  mxContent(xContent),
276  pDocShell( pDocSh ),
277  aCellPos( rPos )
278 {
280 
282 }
283 
285 {
286  SolarMutexGuard g;
287 
288  if (pDocShell)
290 
291  mpEditSource.reset();
292 
293  // increment refcount to prevent double call off dtor
294  osl_atomic_increment( &m_refCount );
295 
296  if (mpRefreshListeners)
297  {
298  lang::EventObject aEvent;
299  aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
300  mpRefreshListeners->disposeAndClear(aEvent);
301  mpRefreshListeners.reset();
302  }
303 }
304 
306 {
307  if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) )
308  {
310  }
311  else if ( rHint.GetId() == SfxHintId::Dying )
312  {
313  pDocShell = nullptr; // became invalid
314  }
315 
316  // EditSource registered itself as a listener
317 }
318 
319 // XIndexAccess (via XTextFields)
320 
321 uno::Reference<text::XTextField> ScCellFieldsObj::GetObjectByIndex_Impl(sal_Int32 Index) const
322 {
324  ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
325  ScUnoEditEngine aTempEngine(pEditEngine);
326  SvxFieldData* pData = aTempEngine.FindByIndex(static_cast<sal_uInt16>(Index));
327  if (!pData)
328  return uno::Reference<text::XTextField>();
329 
330  sal_Int32 nPar = aTempEngine.GetFieldPar();
331  sal_Int32 nPos = aTempEngine.GetFieldPos();
332  ESelection aSelection( nPar, nPos, nPar, nPos+1 ); // Field size is 1 character
333 
334  sal_Int32 eType = pData->GetClassId();
335  uno::Reference<text::XTextField> xRet(
336  new ScEditFieldObj(mxContent, std::make_unique<ScCellEditSource>(pDocShell, aCellPos), eType, aSelection));
337  return xRet;
338 }
339 
340 sal_Int32 SAL_CALL ScCellFieldsObj::getCount()
341 {
342  SolarMutexGuard aGuard;
343 
345  ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
346  ScUnoEditEngine aTempEngine(pEditEngine);
347 
348  return aTempEngine.CountFields(); // count the fields, we don't care about their type in the cell
349 }
350 
351 uno::Any SAL_CALL ScCellFieldsObj::getByIndex( sal_Int32 nIndex )
352 {
353  SolarMutexGuard aGuard;
354  uno::Reference<text::XTextField> xField(GetObjectByIndex_Impl(nIndex));
355  if (!xField.is())
356  throw lang::IndexOutOfBoundsException();
357 
358  return uno::makeAny(xField);
359 }
360 
362 {
363  SolarMutexGuard aGuard;
365 }
366 
368 {
369  SolarMutexGuard aGuard;
370  return ( getCount() != 0 );
371 }
372 
373 uno::Reference<container::XEnumeration> SAL_CALL ScCellFieldsObj::createEnumeration()
374 {
375  SolarMutexGuard aGuard;
376  return new ScIndexEnumeration(this, "com.sun.star.text.TextFieldEnumeration");
377 }
378 
380  const uno::Reference<container::XContainerListener>& /* xListener */ )
381 {
382  OSL_FAIL("not implemented");
383 }
384 
386  const uno::Reference<container::XContainerListener>& /* xListener */ )
387 {
388  OSL_FAIL("not implemented");
389 }
390 
391 // XRefreshable
392 void SAL_CALL ScCellFieldsObj::refresh( )
393 {
394  if (mpRefreshListeners)
395  {
396  // Call all listeners.
397  lang::EventObject aEvent;
398  aEvent.Source.set(uno::Reference< util::XRefreshable >(this));
399  mpRefreshListeners->notifyEach( &util::XRefreshListener::refreshed, aEvent );
400  }
401 }
402 
403 void SAL_CALL ScCellFieldsObj::addRefreshListener( const uno::Reference< util::XRefreshListener >& xListener )
404 {
405  if (xListener.is())
406  {
407  SolarMutexGuard aGuard;
408  if (!mpRefreshListeners)
410  mpRefreshListeners->addInterface(xListener);
411  }
412 }
413 
414 void SAL_CALL ScCellFieldsObj::removeRefreshListener( const uno::Reference<util::XRefreshListener >& xListener )
415 {
416  if (xListener.is())
417  {
418  SolarMutexGuard aGuard;
419  if (mpRefreshListeners)
420  mpRefreshListeners->removeInterface(xListener);
421  }
422 }
423 
425  mrData(rData)
426 {
427  mpEditSource.reset( new ScHeaderFooterEditSource(rData) );
428 }
429 
431 {
432  mpEditSource.reset();
433 
434  // increment refcount to prevent double call off dtor
435  osl_atomic_increment( &m_refCount );
436 
437  if (mpRefreshListeners)
438  {
439  lang::EventObject aEvent;
440  aEvent.Source = static_cast<cppu::OWeakObject*>(this);
441  mpRefreshListeners->disposeAndClear(aEvent);
442  mpRefreshListeners.reset();
443  }
444 }
445 
446 // XIndexAccess (via XTextFields)
447 
448 uno::Reference<text::XTextField> ScHeaderFieldsObj::GetObjectByIndex_Impl(sal_Int32 Index) const
449 {
451  ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
452  ScUnoEditEngine aTempEngine(pEditEngine);
453 
454  SvxFieldData* pData = aTempEngine.FindByIndex(static_cast<sal_uInt16>(Index));
455  if (!pData)
456  return nullptr;
457 
458  // Get the parent text range instance.
459  uno::Reference<text::XTextRange> xTextRange;
460  uno::Reference<sheet::XHeaderFooterContent> xContentObj = mrData.GetContentObj();
461  if (!xContentObj.is())
462  throw uno::RuntimeException("");
463 
465  uno::Reference<text::XText> xText;
466 
467  switch ( mrData.GetPart() )
468  {
470  xText = pContentObj->getLeftText();
471  break;
473  xText = pContentObj->getCenterText();
474  break;
476  xText = pContentObj->getRightText();
477  break;
478  }
479 
480  xTextRange = xText;
481 
482  sal_Int32 nPar = aTempEngine.GetFieldPar();
483  sal_Int32 nPos = aTempEngine.GetFieldPos();
484  ESelection aSelection( nPar, nPos, nPar, nPos+1 ); // Field size is 1 character
485 
486  sal_Int32 eRealType = pData->GetClassId();
487  uno::Reference<text::XTextField> xRet(
488  new ScEditFieldObj(xTextRange, std::make_unique<ScHeaderFooterEditSource>(mrData), eRealType, aSelection));
489  return xRet;
490 }
491 
492 sal_Int32 SAL_CALL ScHeaderFieldsObj::getCount()
493 {
494  SolarMutexGuard aGuard;
495 
497  ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
498  ScUnoEditEngine aTempEngine(pEditEngine);
499  return aTempEngine.CountFields();
500 }
501 
502 uno::Any SAL_CALL ScHeaderFieldsObj::getByIndex( sal_Int32 nIndex )
503 {
504  SolarMutexGuard aGuard;
505  uno::Reference<text::XTextField> xField(GetObjectByIndex_Impl(nIndex));
506  if (!xField.is())
507  throw lang::IndexOutOfBoundsException();
508 
509  return uno::makeAny(xField);
510 }
511 
513 {
514  SolarMutexGuard aGuard;
516 }
517 
519 {
520  SolarMutexGuard aGuard;
521  return ( getCount() != 0 );
522 }
523 
524 uno::Reference<container::XEnumeration> SAL_CALL ScHeaderFieldsObj::createEnumeration()
525 {
526  SolarMutexGuard aGuard;
527  return new ScIndexEnumeration(this, "com.sun.star.text.TextFieldEnumeration");
528 }
529 
531  const uno::Reference<container::XContainerListener>& /* xListener */ )
532 {
533  OSL_FAIL("not implemented");
534 }
535 
537  const uno::Reference<container::XContainerListener>& /* xListener */ )
538 {
539  OSL_FAIL("not implemented");
540 }
541 
542 // XRefreshable
544 {
545  if (mpRefreshListeners)
546  {
547  // Call all listeners.
548  lang::EventObject aEvent;
549  aEvent.Source.set(uno::Reference< util::XRefreshable >(this));
550  mpRefreshListeners->notifyEach( &util::XRefreshListener::refreshed, aEvent);
551  }
552 }
553 
554 void SAL_CALL ScHeaderFieldsObj::addRefreshListener( const uno::Reference< util::XRefreshListener >& xListener )
555 {
556  if (xListener.is())
557  {
558  SolarMutexGuard aGuard;
559  if (!mpRefreshListeners)
561  mpRefreshListeners->addInterface(xListener);
562  }
563 }
564 
565 void SAL_CALL ScHeaderFieldsObj::removeRefreshListener( const uno::Reference<util::XRefreshListener >& xListener )
566 {
567  if (xListener.is())
568  {
569  SolarMutexGuard aGuard;
570  if (mpRefreshListeners)
571  mpRefreshListeners->removeInterface(xListener);
572  }
573 }
574 
576 {
577  if (!mpData)
578  {
579  switch (meType)
580  {
582  mpData.reset(new SvxDateField);
583  break;
584  case text::textfield::Type::EXTENDED_FILE:
585  mpData.reset(
586  new SvxExtFileField(OUString(), SvxFileType::Var, SvxFileFormat::NameAndExt));
587  break;
588  case text::textfield::Type::PAGE:
589  mpData.reset(new SvxPageField);
590  break;
591  case text::textfield::Type::PAGES:
592  mpData.reset(new SvxPagesField);
593  break;
595  mpData.reset(new SvxTableField);
596  break;
597  case text::textfield::Type::TIME:
598  mpData.reset(new SvxTimeField);
599  break;
600  case text::textfield::Type::EXTENDED_TIME:
601  {
602  if (mbIsDate)
603  mpData.reset(new SvxDateField);
604  else
605  mpData.reset(new SvxExtTimeField);
606  }
607  break;
608  case text::textfield::Type::DOCINFO_TITLE:
609  mpData.reset(new SvxFileField);
610  break;
611  case text::textfield::Type::URL:
612  mpData.reset(
613  new SvxURLField(OUString(), OUString(), SvxURLFormat::AppDefault));
614  break;
615  default:
616  mpData.reset(new SvxFieldData);
617  }
618  }
619  return *mpData;
620 }
621 
622 void ScEditFieldObj::setPropertyValueURL(const OUString& rName, const css::uno::Any& rVal)
623 {
624  OUString aStrVal;
625  if (mpEditSource)
626  {
627  // Edit engine instance already exists for this field item. Use it.
628  ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
629  ScUnoEditEngine aTempEngine(pEditEngine);
630 
631  // don't care about the type (only URLs can be found in the cells)
632  SvxFieldData* pField = aTempEngine.FindByPos(
633  aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED);
634  OSL_ENSURE(pField,"setPropertyValue: Field not found");
635  if (!pField)
636  return;
637 
638  if (pField->GetClassId() != text::textfield::Type::URL)
639  // Make sure this is indeed a URL field.
640  return;
641 
642  SvxURLField* pURL = static_cast<SvxURLField*>(pField);
643 
644  if (rName == SC_UNONAME_URL)
645  {
646  if (rVal >>= aStrVal)
647  pURL->SetURL(aStrVal);
648  }
649  else if (rName == SC_UNONAME_REPR)
650  {
651  if (rVal >>= aStrVal)
652  pURL->SetRepresentation(aStrVal);
653  }
654  else if (rName == SC_UNONAME_TARGET)
655  {
656  if (rVal >>= aStrVal)
657  pURL->SetTargetFrame(aStrVal);
658  }
659  else
660  throw beans::UnknownPropertyException(rName);
661 
662  pEditEngine->QuickInsertField( SvxFieldItem(*pField, EE_FEATURE_FIELD), aSelection );
663  mpEditSource->UpdateData();
664  return;
665  }
666 
667  // Edit engine instance not yet present. Store the item data for later use.
668  SvxURLField& rData = static_cast<SvxURLField&>(getData());
669  if (rName == SC_UNONAME_URL)
670  {
671  if (rVal >>= aStrVal)
672  rData.SetURL(aStrVal);
673  }
674  else if (rName == SC_UNONAME_REPR)
675  {
676  if (rVal >>= aStrVal)
677  rData.SetRepresentation(aStrVal);
678  }
679  else if (rName == SC_UNONAME_TARGET)
680  {
681  if (rVal >>= aStrVal)
682  rData.SetTargetFrame(aStrVal);
683  }
684  else
685  throw beans::UnknownPropertyException(rName);
686 }
687 
689 {
690  uno::Any aRet;
691 
692  // anchor type is always "as character", text wrap always "none"
693 
694  if (mpEditSource)
695  {
697  ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
698  ScUnoEditEngine aTempEngine(pEditEngine);
699 
700  // don't care about the type (only URLs can be found in the cells)
701  const SvxFieldData* pField = aTempEngine.FindByPos(
702  aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED);
703  OSL_ENSURE(pField,"getPropertyValue: Field not found");
704  if (!pField)
705  throw uno::RuntimeException();
706 
707  if (pField->GetClassId() != text::textfield::Type::URL)
708  throw uno::RuntimeException();
709 
710  const SvxURLField* pURL = static_cast<const SvxURLField*>(pField);
711 
712  if (rName == SC_UNONAME_URL)
713  aRet <<= pURL->GetURL();
714  else if (rName == SC_UNONAME_REPR)
715  aRet <<= pURL->GetRepresentation();
716  else if (rName == SC_UNONAME_TARGET)
717  aRet <<= pURL->GetTargetFrame();
718  else
719  throw beans::UnknownPropertyException(rName);
720  }
721  else // not inserted yet
722  {
723  const SvxURLField& rURL = static_cast<const SvxURLField&>(getData());
724 
725  if (rName == SC_UNONAME_URL)
726  aRet <<= rURL.GetURL();
727  else if (rName == SC_UNONAME_REPR)
728  aRet <<= rURL.GetRepresentation();
729  else if (rName == SC_UNONAME_TARGET)
730  aRet <<= rURL.GetTargetFrame();
731  else
732  throw beans::UnknownPropertyException(rName);
733  }
734  return aRet;
735 }
736 
737 void ScEditFieldObj::setPropertyValueFile(const OUString& rName, const uno::Any& rVal)
738 {
739  if (rName != SC_UNONAME_FILEFORM)
740  throw beans::UnknownPropertyException(rName);
741 
742  sal_Int16 nIntVal = 0;
743  if (rVal >>= nIntVal)
744  {
745  SvxFileFormat eFormat = lcl_UnoToSvxFileFormat(nIntVal);
746  if (mpEditSource)
747  {
748  ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
749  ScUnoEditEngine aTempEngine(pEditEngine);
750  SvxFieldData* pField = aTempEngine.FindByPos(
751  aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::EXTENDED_FILE);
752  OSL_ENSURE(pField, "setPropertyValueFile: Field not found");
753  if (pField)
754  {
755  SvxExtFileField* pExtFile = static_cast<SvxExtFileField*>(pField); // local to the ScUnoEditEngine
756  pExtFile->SetFormat(eFormat);
757  pEditEngine->QuickInsertField(SvxFieldItem(*pField, EE_FEATURE_FIELD), aSelection);
758  mpEditSource->UpdateData();
759  }
760  }
761  else
762  {
763  SvxExtFileField& rExtFile = static_cast<SvxExtFileField&>(getData());
764  rExtFile.SetFormat(eFormat);
765  }
766  }
767 
768 }
769 
771 {
772  uno::Any aRet;
773  if (rName != SC_UNONAME_FILEFORM)
774  throw beans::UnknownPropertyException(rName);
775 
776  SvxFileFormat eFormat = SvxFileFormat::NameAndExt;
777  const SvxFieldData* pField = nullptr;
778  if (mpEditSource)
779  {
780  ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
781  ScUnoEditEngine aTempEngine(pEditEngine);
782  pField = aTempEngine.FindByPos(
783  aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::EXTENDED_FILE);
784  }
785  else
786  pField = &getData();
787 
788  OSL_ENSURE(pField, "setPropertyValueFile: Field not found");
789  if (!pField)
790  throw uno::RuntimeException();
791 
792  const SvxExtFileField* pExtFile = static_cast<const SvxExtFileField*>(pField);
793  eFormat = pExtFile->GetFormat();
794  sal_Int16 nIntVal = lcl_SvxToUnoFileFormat(eFormat);
795  aRet <<= nIntVal;
796 
797  return aRet;
798 }
799 
800 void ScEditFieldObj::setPropertyValueDateTime(const OUString& rName, const uno::Any& rVal)
801 {
802  if (mpEditSource)
803  {
804  // Field already inserted.
805  ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
806  ScUnoEditEngine aTempEngine(pEditEngine);
807  SvxFieldData* pField = aTempEngine.FindByPos(aSelection.nStartPara, aSelection.nStartPos, meType);
808  if (!pField)
809  return;
810 
811  switch (meType)
812  {
814  {
815  SvxDateField* p = static_cast<SvxDateField*>(pField);
816  if (rName == SC_UNONAME_ISDATE)
817  {
818  // Do nothing for now.
819  }
820  else if (rName == SC_UNONAME_ISFIXED)
821  {
822  SvxDateType eType = rVal.get<bool>() ? SvxDateType::Fix : SvxDateType::Var;
823  p->SetType(eType);
824  }
825  else if (rName == SC_UNONAME_DATETIME)
826  {
827  maDateTime = rVal.get<util::DateTime>();
828  Date aDate(maDateTime.Day, maDateTime.Month, maDateTime.Year);
829  p->SetFixDate(aDate);
830  }
831  else if (rName == SC_UNONAME_NUMFMT)
832  {
833  mnNumFormat = rVal.get<sal_Int32>();
834  p->SetFormat(static_cast<SvxDateFormat>(mnNumFormat));
835  }
836  else
837  throw beans::UnknownPropertyException(rName);
838  }
839  break;
840  case text::textfield::Type::TIME:
841  {
842  // SvxTimeField doesn't have any attributes.
843  if (rName != SC_UNONAME_ISDATE && rName != SC_UNONAME_ISFIXED &&
844  rName != SC_UNONAME_DATETIME && rName != SC_UNONAME_NUMFMT)
845  throw beans::UnknownPropertyException(rName);
846  }
847  break;
848  case text::textfield::Type::EXTENDED_TIME:
849  {
850  SvxExtTimeField* p = static_cast<SvxExtTimeField*>(pField);
851  if (rName == SC_UNONAME_ISDATE)
852  {
853  // Do nothing for now.
854  }
855  else if (rName == SC_UNONAME_ISFIXED)
856  {
857  SvxTimeType eType = rVal.get<bool>() ? SvxTimeType::Fix : SvxTimeType::Var;
858  p->SetType(eType);
859  }
860  else if (rName == SC_UNONAME_DATETIME)
861  {
862  maDateTime = rVal.get<util::DateTime>();
863  tools::Time aTime(maDateTime);
864  p->SetFixTime(aTime);
865  }
866  else if (rName == SC_UNONAME_NUMFMT)
867  {
868  mnNumFormat = rVal.get<sal_Int32>();
869  p->SetFormat(static_cast<SvxTimeFormat>(mnNumFormat));
870  }
871  else
872  throw beans::UnknownPropertyException(rName);
873  }
874  break;
875  default:
876  throw beans::UnknownPropertyException(rName);
877  }
878  }
879  else
880  {
881  if (rName == SC_UNONAME_ISDATE)
882  mbIsDate = rVal.get<bool>();
883  else if (rName == SC_UNONAME_ISFIXED)
884  mbIsFixed = rVal.get<bool>();
885  else if (rName == SC_UNONAME_DATETIME)
886  maDateTime = rVal.get<util::DateTime>();
887  else if (rName == SC_UNONAME_NUMFMT)
888  mnNumFormat = rVal.get<sal_Int32>();
889  else
890  throw beans::UnknownPropertyException(rName);
891  }
892 }
893 
895 {
896  if (mpEditSource)
897  {
898  // Field already inserted.
899  ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
900  ScUnoEditEngine aTempEngine(pEditEngine);
901  SvxFieldData* pField = aTempEngine.FindByPos(aSelection.nStartPara, aSelection.nStartPos, meType);
902  if (!pField)
903  throw uno::RuntimeException();
904 
905  switch (meType)
906  {
908  {
909  SvxDateField* p = static_cast<SvxDateField*>(pField);
910  if (rName == SC_UNONAME_ISDATE)
911  return uno::makeAny(true);
912 
913  if (rName == SC_UNONAME_ISFIXED)
914  return uno::makeAny<sal_Bool>(p->GetType() == SvxDateType::Fix);
915 
916  if (rName == SC_UNONAME_DATETIME)
917  {
918  Date aD(p->GetFixDate());
919  maDateTime.Year = aD.GetYear();
920  maDateTime.Month = aD.GetMonth();
921  maDateTime.Day = aD.GetDay();
922  maDateTime.Hours = 0;
923  maDateTime.Minutes = 0;
924  maDateTime.Seconds = 0;
925  maDateTime.NanoSeconds = 0;
926  return uno::makeAny(maDateTime);
927  }
928 
929  if (rName == SC_UNONAME_NUMFMT)
930  return uno::makeAny<sal_Int32>(static_cast<sal_Int32>(p->GetFormat()));
931  }
932  break;
933  case text::textfield::Type::TIME:
934  {
935  // SvxTimeField doesn't have any attributes.
936  if (rName == SC_UNONAME_ISDATE)
937  return uno::makeAny(false);
938 
939  if (rName == SC_UNONAME_ISFIXED)
940  return uno::makeAny(false);
941 
942  if (rName == SC_UNONAME_DATETIME)
943  // This is the best we can do.
944  return uno::makeAny(maDateTime);
945 
946  if (rName == SC_UNONAME_NUMFMT)
947  // Same as above.
948  return uno::makeAny<sal_Int32>(0);
949  }
950  break;
951  case text::textfield::Type::EXTENDED_TIME:
952  {
953  SvxExtTimeField* p = static_cast<SvxExtTimeField*>(pField);
954  if (rName == SC_UNONAME_ISDATE)
955  return uno::makeAny(false);
956 
957  if (rName == SC_UNONAME_ISFIXED)
958  return uno::makeAny<sal_Bool>(p->GetType() == SvxTimeType::Fix);
959 
960  if (rName == SC_UNONAME_DATETIME)
961  {
962  tools::Time aT(p->GetFixTime());
963  maDateTime.Year = 0;
964  maDateTime.Month = 0;
965  maDateTime.Day = 0;
966  maDateTime.Hours = aT.GetHour();
967  maDateTime.Minutes = aT.GetMin();
968  maDateTime.Seconds = aT.GetSec();
969  maDateTime.NanoSeconds = aT.GetNanoSec();
970  return uno::makeAny(maDateTime);
971  }
972 
973  if (rName == SC_UNONAME_NUMFMT)
974  return uno::makeAny<sal_Int32>(static_cast<sal_Int32>(p->GetFormat()));
975  }
976  break;
977  default:
978  ;
979  }
980  }
981  else
982  {
983  if (rName == SC_UNONAME_ISDATE)
984  return uno::makeAny<sal_Bool>(mbIsDate);
985 
986  if (rName == SC_UNONAME_ISFIXED)
987  return uno::makeAny<sal_Bool>(mbIsFixed);
988 
989  if (rName == SC_UNONAME_DATETIME)
990  return uno::makeAny(maDateTime);
991 
992  if (rName == SC_UNONAME_NUMFMT)
993  return uno::makeAny(mnNumFormat);
994  }
995 
996  throw beans::UnknownPropertyException(rName);
997 }
998 
999 void ScEditFieldObj::setPropertyValueSheet(const OUString& rName, const uno::Any& rVal)
1000 {
1001  if (mpEditSource)
1002  {
1003  // Edit engine instance already exists for this field item. Use it.
1004  ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
1005  ScUnoEditEngine aTempEngine(pEditEngine);
1006 
1007  // don't care about the type (only URLs can be found in the cells)
1008  SvxFieldData* pField = aTempEngine.FindByPos(
1009  aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED);
1010  OSL_ENSURE(pField,"setPropertyValue: Field not found");
1011  if (!pField)
1012  return;
1013 
1014  if (pField->GetClassId() != text::textfield::Type::TABLE)
1015  // Make sure this is indeed a URL field.
1016  return;
1017 
1018  SvxTableField* p = static_cast<SvxTableField*>(pField);
1019 
1020  if (rName != SC_UNONAME_TABLEPOS)
1021  throw beans::UnknownPropertyException(rName);
1022 
1023  sal_Int32 nTab = rVal.get<sal_Int32>();
1024  p->SetTab(nTab);
1025 
1026 
1027  pEditEngine->QuickInsertField(SvxFieldItem(*pField, EE_FEATURE_FIELD), aSelection);
1028  mpEditSource->UpdateData();
1029  return;
1030  }
1031 
1032  // Edit engine instance not yet present. Store the item data for later use.
1033  SvxTableField& r = static_cast<SvxTableField&>(getData());
1034  if (rName != SC_UNONAME_TABLEPOS)
1035  throw beans::UnknownPropertyException(rName);
1036 
1037  sal_Int32 nTab = rVal.get<sal_Int32>();
1038  r.SetTab(nTab);
1039 }
1040 
1042  const uno::Reference<text::XTextRange>& rContent,
1043  std::unique_ptr<ScEditSource> pEditSrc, sal_Int32 eType, const ESelection& rSel) :
1044  OComponentHelper(getMutex()),
1045  pPropSet(nullptr),
1046  mpEditSource(std::move(pEditSrc)),
1047  aSelection(rSel),
1048  meType(eType), mpContent(rContent), mnNumFormat(0), mbIsDate(false), mbIsFixed(false)
1049 {
1050  switch (meType)
1051  {
1052  case text::textfield::Type::DOCINFO_TITLE:
1053  pPropSet = getEmptyPropertySet();
1054  break;
1055  case text::textfield::Type::EXTENDED_FILE:
1056  pPropSet = lcl_GetFileFieldPropertySet();
1057  break;
1058  case text::textfield::Type::URL:
1059  pPropSet = lcl_GetURLPropertySet();
1060  break;
1062  case text::textfield::Type::TIME:
1063  case text::textfield::Type::EXTENDED_TIME:
1064  pPropSet = getDateTimePropertySet();
1065  break;
1066  default:
1067  pPropSet = lcl_GetHeaderFieldPropertySet();
1068  }
1069 
1071  mbIsDate = true;
1072 }
1073 
1075  const uno::Reference<text::XTextRange>& rContent, std::unique_ptr<ScEditSource> pEditSrc, const ESelection& rSel)
1076 {
1077  if (!mpEditSource)
1078  {
1079  mpContent = rContent;
1080  mpData.reset();
1081 
1082  aSelection = rSel;
1083  mpEditSource = std::move( pEditSrc );
1084  }
1085 }
1086 
1088 {
1089 }
1090 
1092 {
1093  OSL_ENSURE( !mpEditSource, "CreateFieldItem with inserted field" );
1095 }
1096 
1098 {
1099  if (mpEditSource)
1100  {
1101  SvxTextForwarder* pForwarder = mpEditSource->GetTextForwarder();
1102  pForwarder->QuickInsertText( OUString(), aSelection );
1103  mpEditSource->UpdateData();
1104 
1107 
1110  }
1111 }
1112 
1114 {
1115  return mpEditSource != nullptr;
1116 }
1117 
1118 // XTextField
1119 
1120 OUString SAL_CALL ScEditFieldObj::getPresentation( sal_Bool bShowCommand )
1121 {
1122  SolarMutexGuard aGuard;
1123 
1124  if (!mpEditSource)
1125  return OUString();
1126 
1128  ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
1129  ScUnoEditEngine aTempEngine(pEditEngine);
1130 
1131  // don't care about the type (only URLs can be found in the cells)
1132  const SvxFieldData* pField = aTempEngine.FindByPos(
1133  aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED);
1134  OSL_ENSURE(pField,"getPresentation: Field not found");
1135  if (!pField)
1136  return OUString();
1137 
1138  switch (meType)
1139  {
1140  case text::textfield::Type::URL:
1141  {
1142  if (pField->GetClassId() != text::textfield::Type::URL)
1143  // Not a URL field, but URL is expected.
1144  throw uno::RuntimeException();
1145 
1146  const SvxURLField* pURL = static_cast<const SvxURLField*>(pField);
1147  return bShowCommand ? pURL->GetURL() : pURL->GetRepresentation();
1148  }
1149  break;
1150  default:
1151  ;
1152  }
1153  return OUString();
1154 }
1155 
1156 // XTextContent
1157 
1158 void SAL_CALL ScEditFieldObj::attach( const uno::Reference<text::XTextRange>& xTextRange )
1159 {
1160  SolarMutexGuard aGuard;
1161  if (xTextRange.is())
1162  {
1163  uno::Reference<text::XText> xText(xTextRange->getText());
1164  if (xText.is())
1165  {
1166  xText->insertTextContent( xTextRange, this, true );
1167  }
1168  }
1169 }
1170 
1171 uno::Reference<text::XTextRange> SAL_CALL ScEditFieldObj::getAnchor()
1172 {
1173  SolarMutexGuard aGuard;
1174  return mpContent;
1175 }
1176 
1177 // XComponent
1178 
1180 {
1181  OComponentHelper::dispose();
1182 }
1183 
1185  const uno::Reference<lang::XEventListener>& xListener )
1186 {
1187  OComponentHelper::addEventListener( xListener );
1188 }
1189 
1191  const uno::Reference<lang::XEventListener>& xListener )
1192 {
1193  OComponentHelper::removeEventListener( xListener );
1194 }
1195 
1196 // XPropertySet
1197 
1198 uno::Reference<beans::XPropertySetInfo> SAL_CALL ScEditFieldObj::getPropertySetInfo()
1199 {
1200  SolarMutexGuard aGuard;
1201  uno::Reference<beans::XPropertySetInfo> aRef = pPropSet->getPropertySetInfo();
1202  return aRef;
1203 }
1204 
1206  const OUString& aPropertyName, const uno::Any& aValue )
1207 {
1208  SolarMutexGuard aGuard;
1209  if (aPropertyName == SC_UNONAME_ANCHOR)
1210  {
1211  aValue >>= mpContent;
1212  return;
1213  }
1214 
1215  switch (meType)
1216  {
1217  case text::textfield::Type::URL:
1218  setPropertyValueURL(aPropertyName, aValue);
1219  break;
1220  case text::textfield::Type::EXTENDED_FILE:
1221  setPropertyValueFile(aPropertyName, aValue);
1222  break;
1224  case text::textfield::Type::TIME:
1225  case text::textfield::Type::EXTENDED_TIME:
1226  setPropertyValueDateTime(aPropertyName, aValue);
1227  break;
1229  setPropertyValueSheet(aPropertyName, aValue);
1230  break;
1231  case text::textfield::Type::DOCINFO_TITLE:
1232  default:
1233  throw beans::UnknownPropertyException(OUString::number(meType));
1234  }
1235 }
1236 
1237 uno::Any SAL_CALL ScEditFieldObj::getPropertyValue( const OUString& aPropertyName )
1238 {
1239  SolarMutexGuard aGuard;
1240  if (aPropertyName == SC_UNONAME_TEXTFIELD_TYPE)
1241  return uno::makeAny(meType);
1242 
1243  if (aPropertyName == SC_UNONAME_ANCHOR)
1244  return uno::makeAny(mpContent);
1245 
1246  if (aPropertyName == SC_UNONAME_ANCTYPE)
1247  {
1248  uno::Any aRet;
1249  aRet <<= text::TextContentAnchorType_AS_CHARACTER;
1250  return aRet;
1251  }
1252  if (aPropertyName == SC_UNONAME_ANCTYPES)
1253  {
1254  uno::Any aRet;
1255  uno::Sequence<text::TextContentAnchorType> aSeq(1);
1256  aSeq[0] = text::TextContentAnchorType_AS_CHARACTER;
1257  aRet <<= aSeq;
1258  return aRet;
1259  }
1260  if (aPropertyName == SC_UNONAME_TEXTWRAP)
1261  {
1262  uno::Any aRet;
1263  aRet <<= text::WrapTextMode_NONE;
1264  return aRet;
1265  }
1266 
1267  switch (meType)
1268  {
1269  case text::textfield::Type::URL:
1270  return getPropertyValueURL(aPropertyName);
1271  case text::textfield::Type::EXTENDED_FILE:
1272  return getPropertyValueFile(aPropertyName);
1274  case text::textfield::Type::TIME:
1275  case text::textfield::Type::EXTENDED_TIME:
1276  return getPropertyValueDateTime(aPropertyName);
1277  case text::textfield::Type::DOCINFO_TITLE:
1278  default:
1279  throw beans::UnknownPropertyException(OUString::number(meType));
1280  }
1281 }
1282 
1284 
1285 // XUnoTunnel
1286 
1288 
1289 // XServiceInfo
1290 
1291 OUString SAL_CALL ScEditFieldObj::getImplementationName()
1292 {
1293  return "ScEditFieldObj";
1294 }
1295 
1296 sal_Bool SAL_CALL ScEditFieldObj::supportsService( const OUString& rServiceName )
1297 {
1298  return cppu::supportsService(this, rServiceName);
1299 }
1300 
1301 uno::Sequence<OUString> SAL_CALL ScEditFieldObj::getSupportedServiceNames()
1302 {
1303  return {"com.sun.star.text.TextField",
1304  "com.sun.star.text.TextContent"};
1305 }
1306 
1307 uno::Sequence<uno::Type> SAL_CALL ScEditFieldObj::getTypes()
1308 {
1310  OComponentHelper::getTypes(),
1311  uno::Sequence<uno::Type>
1312  {
1317  } );
1318 }
1319 
1320 uno::Sequence<sal_Int8> SAL_CALL ScEditFieldObj::getImplementationId()
1321 {
1322  return css::uno::Sequence<sal_Int8>();
1323 }
1324 
1325 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define SC_UNONAME_ISFIXED
Definition: unonames.hxx:335
std::unique_ptr< ScEditSource > mpEditSource
Definition: fielduno.hxx:176
Type
void SetFixDate(const Date &rDate)
virtual OUString SAL_CALL getPresentation(sal_Bool bShowCommand) override
Definition: fielduno.cxx:1120
void SetTargetFrame(const OUString &rFrm)
std::unique_ptr< SvxFieldData > mpData
Definition: fielduno.hxx:180
sal_Int32 nStartPara
std::unique_ptr< ScEditSource > mpEditSource
Definition: fielduno.hxx:65
osl::Mutex aMutex
mutex to lock the InterfaceContainerHelper
Definition: fielduno.hxx:123
virtual void SAL_CALL removeContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
Definition: fielduno.cxx:536
Data (incl.
Definition: editsrc.hxx:74
virtual OUString CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_Int32 nPos, std::optional< Color > &rTxtColor, std::optional< Color > &rFldColor)
bool IsInserted() const
Definition: fielduno.cxx:1113
ESelection aSelection
Definition: fielduno.hxx:177
std::unique_ptr< ScEditSource > mpEditSource
Definition: fielduno.hxx:118
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: fielduno.cxx:1171
std::unique_ptr< ContentProperties > pData
void SetFormat(SvxDateFormat eFmt)
const SfxItemPropertySet * pPropSet
Definition: fielduno.hxx:175
#define SC_UNONAME_REPR
Definition: unonames.hxx:329
ULONG m_refCount
void QuickInsertField(const SvxFieldItem &rFld, const ESelection &rSel)
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: fielduno.cxx:1198
virtual void SAL_CALL refresh() override
Definition: fielduno.cxx:543
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: fielduno.cxx:373
#define SC_UNONAME_URL
Definition: unonames.hxx:331
SvxTimeType
ScHeaderFooterTextData & mrData
Definition: fielduno.hxx:117
const ContentProperties & rData
virtual css::uno::Type SAL_CALL getElementType() override
Definition: fielduno.cxx:512
SvxTimeType GetType() const
virtual ~ScCellFieldsObj() override
Definition: fielduno.cxx:284
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: fielduno.cxx:305
virtual void SAL_CALL addContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
Definition: fielduno.cxx:379
css::uno::Reference< css::sheet::XHeaderFooterContent > GetContentObj() const
Definition: textuno.hxx:127
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: fielduno.cxx:1320
void SetFormat(SvxTimeFormat eFmt)
css::uno::Reference< css::text::XTextRange > mxContent
Definition: fielduno.hxx:62
const OUString & GetTargetFrame() const
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
SfxHintId GetId() const
void setPropertyValueURL(const OUString &rName, const css::uno::Any &rVal)
Definition: fielduno.cxx:622
css::uno::Reference< css::text::XTextRange > mpContent
Definition: fielduno.hxx:181
UNO3_GETIMPLEMENTATION_IMPL(ScEditFieldObj)
#define SC_UNONAME_ANCTYPE
Definition: unonames.hxx:322
HashMap_OWString_Interface aMap
Generic UNO wrapper for edit engine's field item in cells, headers, and footers.
Definition: fielduno.hxx:163
ObjectFormatterData & mrData
#define SC_UNONAME_ANCHOR
Definition: unonames.hxx:194
std::unique_ptr< comphelper::OInterfaceContainerHelper2 > mpRefreshListeners
List of refresh listeners.
Definition: fielduno.hxx:121
void SetFixTime(const tools::Time &rTime)
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: fielduno.cxx:524
#define SC_UNONAME_DATETIME
Definition: unonames.hxx:336
ScAddress aCellPos
Definition: fielduno.hxx:64
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
Definition: fielduno.cxx:565
virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: fielduno.cxx:1158
void SetFormat(SvxFileFormat eFmt)
Mode eMode
css::uno::Reference< css::text::XTextField > GetObjectByIndex_Impl(sal_Int32 Index) const
Definition: fielduno.cxx:448
SvxFileFormat GetFormat() const
ScEditFieldObj()=delete
sal_Int32 nEndPos
SvxDateType
virtual void SAL_CALL removeContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
Definition: fielduno.cxx:385
SvxDateFormat GetFormat() const
ScUnoCollectMode
Definition: fielduno.cxx:152
#define SC_UNONAME_TEXTWRAP
Definition: unonames.hxx:324
DocumentType eType
static rtl::Reference< ScHeaderFooterContentObj > getImplementation(const css::uno::Reference< css::sheet::XHeaderFooterContent > &rObj)
Definition: textuno.cxx:157
exports com.sun.star. text
SvxFieldItem CreateFieldItem()
Definition: fielduno.cxx:1091
sal_Int32 meType
Definition: fielduno.hxx:179
css::uno::Reference< css::text::XTextField > GetObjectByIndex_Impl(sal_Int32 Index) const
Definition: fielduno.cxx:321
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: fielduno.cxx:1307
css::uno::Any getPropertyValueFile(const OUString &rName)
Definition: fielduno.cxx:770
virtual void SAL_CALL refresh() override
Definition: fielduno.cxx:392
sal_Int32 nEndPara
sal_Int32 GetFixDate() const
virtual sal_Int32 SAL_CALL getCount() override
Definition: fielduno.cxx:492
void InitDoc(const css::uno::Reference< css::text::XTextRange > &rContent, std::unique_ptr< ScEditSource > pEditSrc, const ESelection &rSel)
Definition: fielduno.cxx:1074
virtual ~ScHeaderFieldsObj() override
Definition: fielduno.cxx:430
void SetRepresentation(const OUString &rRep)
virtual void SAL_CALL addContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
Definition: fielduno.cxx:530
osl::Mutex aMutex
mutex to lock the InterfaceContainerHelper
Definition: fielduno.hxx:69
std::unique_ptr< EditTextObject > CreateTextObject()
#define SC_UNONAME_TARGET
Definition: unonames.hxx:330
unsigned char sal_Bool
virtual ~ScEditFieldObj() override
Definition: fielduno.cxx:1087
virtual sal_Bool SAL_CALL hasElements() override
Definition: fielduno.cxx:367
css::util::DateTime maDateTime
Definition: fielduno.hxx:183
const OUString & GetRepresentation() const
ScHeaderFooterTextObj keeps the authoritative copy of ScHeaderFooterTextData that this class holds re...
Definition: editsrc.hxx:50
css::uno::Type const & get()
#define SC_SIMPLE_SERVICE_INFO(ClassName, ClassNameAscii, ServiceAscii)
Definition: miscuno.hxx:64
SvxFieldData & getData()
Definition: fielduno.cxx:575
void setPropertyValueFile(const OUString &rName, const css::uno::Any &rVal)
Definition: fielduno.cxx:737
css::uno::Any getPropertyValueDateTime(const OUString &rName)
Definition: fielduno.cxx:894
virtual sal_Int32 SAL_CALL getCount() override
Definition: fielduno.cxx:340
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: fielduno.cxx:1296
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &...rSn)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: fielduno.cxx:1301
ScHeaderFieldsObj(ScHeaderFooterTextData &rData)
Definition: fielduno.cxx:424
sal_Int64 GetFixTime() const
#define SC_IMPL_DUMMY_PROPERTY_LISTENER(ClassName)
Definition: miscuno.hxx:73
const OUString & GetURL() const
void AddUnoObject(SfxListener &rObject)
Definition: documen3.cxx:879
void DeleteField()
Definition: fielduno.cxx:1097
virtual sal_Int32 GetClassId() const
virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
Definition: fielduno.cxx:403
css::uno::Any getPropertyValueURL(const OUString &rName)
Definition: fielduno.cxx:688
virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
Definition: fielduno.cxx:414
sal_Int32 mnNumFormat
Definition: fielduno.hxx:184
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: fielduno.cxx:502
std::unique_ptr< comphelper::OInterfaceContainerHelper2 > mpRefreshListeners
List of refresh listeners.
Definition: fielduno.hxx:67
#define SC_UNONAME_ISDATE
Definition: unonames.hxx:334
#define SC_UNONAME_NUMFMT
Definition: unonames.hxx:106
#define SC_UNONAME_TABLEPOS
Definition: unonames.hxx:339
virtual void SAL_CALL dispose() override
Definition: fielduno.cxx:1179
void RemoveUnoObject(SfxListener &rObject)
Definition: documen3.cxx:887
void * p
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:401
Sequence< sal_Int8 > aSeq
const ScDocument & GetDocument() const
Definition: docsh.hxx:216
SvxDateType GetType() const
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: fielduno.cxx:1184
ScDocShell * pDocShell
Definition: fielduno.hxx:63
virtual void QuickInsertText(const OUString &rText, const ESelection &rSel)=0
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: fielduno.cxx:1205
SvxTimeFormat GetFormat() const
constexpr sal_uInt16 EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
exports com.sun.star.text. textfield
virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
Definition: fielduno.cxx:554
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: fielduno.cxx:1190
void SetURL(const OUString &rURL)
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: fielduno.cxx:351
virtual css::uno::Type SAL_CALL getElementType() override
Definition: fielduno.cxx:361
void setPropertyValueDateTime(const OUString &rName, const css::uno::Any &rVal)
Definition: fielduno.cxx:800
virtual std::unique_ptr< SvxFieldData > Clone() const
#define SC_UNONAME_FILEFORM
Definition: unonames.hxx:325
ScHeaderFooterPart GetPart() const
Definition: textuno.hxx:126
void setPropertyValueSheet(const OUString &rName, const css::uno::Any &rVal)
Definition: fielduno.cxx:999
struct _ADOIndex Index
void SetType(SvxTimeType eTp)
RedlineType meType
void SetTab(int nTab)
AnyEventRef aEvent
#define SC_UNONAME_ANCTYPES
Definition: unonames.hxx:323
virtual sal_Bool SAL_CALL hasElements() override
Definition: fielduno.cxx:518
ScCellFieldsObj(const css::uno::Reference< css::text::XTextRange > &xContent, ScDocShell *pDocSh, const ScAddress &rPos)
Definition: fielduno.cxx:272
SvxFileFormat
void SetType(SvxDateType eTp)
const SvxFieldData * GetField() const
#define SC_UNONAME_TEXTFIELD_TYPE
Definition: unonames.hxx:326
::osl::Mutex & getMutex()
sal_Int32 nStartPos
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: fielduno.cxx:1237