20#undef SC_DLLIMPLEMENTATION
45 :
SfxTabPage(pPage, pController,
"modules/scalc/ui/headerfootercontent.ui",
"HeaderFooterContent", &rCoreAttrs)
47 , m_bDropDownActive(false)
49 , m_xFtDefinedHF(m_xBuilder->weld_label(!bHeader ?
"labelFT_F_DEFINED" :
"labelFT_H_DEFINED"))
50 , m_xLbDefined(m_xBuilder->weld_combo_box(
"comboLB_DEFINED"))
51 , m_xFtCustomHF(m_xBuilder->weld_label(!bHeader ?
"labelFT_F_CUSTOM" :
"labelFT_H_CUSTOM"))
52 , m_xBtnText(m_xBuilder->weld_button(
"buttonBTN_TEXT"))
53 , m_xBtnFile(m_xBuilder->weld_menu_button(
"buttonBTN_FILE"))
54 , m_xBtnTable(m_xBuilder->weld_button(
"buttonBTN_TABLE"))
55 , m_xBtnPage(m_xBuilder->weld_button(
"buttonBTN_PAGE"))
56 , m_xBtnLastPage(m_xBuilder->weld_button(
"buttonBTN_PAGES"))
57 , m_xBtnDate(m_xBuilder->weld_button(
"buttonBTN_DATE"))
58 , m_xBtnTime(m_xBuilder->weld_button(
"buttonBTN_TIME"))
59 , m_xFtConfidential(m_xBuilder->weld_label(
"labelSTR_HF_CONFIDENTIAL"))
60 , m_xFtPage(m_xBuilder->weld_label(
"labelSTR_PAGE"))
61 , m_xFtOfQuestion(m_xBuilder->weld_label(
"labelSTR_HF_OF_QUESTION"))
62 , m_xFtOf(m_xBuilder->weld_label(
"labelSTR_HF_OF"))
63 , m_xFtNone(m_xBuilder->weld_label(
"labelSTR_HF_NONE_IN_BRACKETS"))
64 , m_xFtCreatedBy(m_xBuilder->weld_label(
"labelSTR_HF_CREATED_BY"))
65 , m_xFtCustomized(m_xBuilder->weld_label(
"labelSTR_HF_CUSTOMIZED"))
66 , m_xLeft(m_xBuilder->weld_widget(
"labelFT_LEFT"))
67 , m_xRight(m_xBuilder->weld_widget(
"labelFT_RIGHT"))
71 , m_xWndLeftWnd(new
weld::CustomWeld(*m_xBuilder,
"textviewWND_LEFT", *m_xWndLeft))
72 , m_xWndCenterWnd(new
weld::CustomWeld(*m_xBuilder,
"textviewWND_CENTER", *m_xWndCenter))
73 , m_xWndRightWnd(new
weld::CustomWeld(*m_xBuilder,
"textviewWND_RIGHT", *m_xWndRight))
74 , m_pEditFocus(nullptr)
102 sal_Int32 nOldLeftAttach =
m_xLeft->get_grid_left_attach();
103 sal_Int32 nOldRightAttach =
m_xRight->get_grid_left_attach();
104 m_xLeft->set_grid_left_attach(nOldRightAttach);
105 m_xRight->set_grid_left_attach(nOldLeftAttach);
133 m_xBtnText->grab_focus();
166 std::unique_ptr<EditTextObject> pLeft =
m_xWndLeft->CreateTextObject();
167 std::unique_ptr<EditTextObject> pCenter =
m_xWndCenter->CreateTextObject();
168 std::unique_ptr<EditTextObject> pRight =
m_xWndRight->CreateTextObject();
174 rCoreSet->
Put( aItem );
183 std::optional<Color> pTxtColour;
184 std::optional<Color> pFldColour;
185 std::optional<FontLineStyle> pFldLineStyle;
198 OUString aPageEntry(
m_xFtPage->get_label() +
" " + aPageFieldValue);
201 OUString aPageOfEntry(aPageEntry +
" " +
m_xFtOfQuestion->get_label());
206 OUString aConfidentialEntry(aUserOpt.
GetCompany() +
" " +
m_xFtConfidential->get_label() +
", " + aDateFieldValue +
", " + aPageEntry);
209 OUString aFileNamePageEntry(aFileFieldValue +
", " + aPageEntry);
214 OUString aPageSheetNameEntry(aPageEntry +
", " + aSheetFieldValue);
217 OUString aPageFileNameEntry(aPageEntry +
", " + aFileFieldValue);
220 OUString aPagePathNameEntry(aPageEntry +
", " + aExtFileFieldValue);
223 OUString aUserNameEntry(aUserOpt.
GetFirstName() +
" " + aUserOpt.
GetLastName() +
", " + aPageEntry +
", " + aDateFieldValue);
227 aDateFieldValue +
", " + aPageEntry;
256 std::unique_ptr< EditTextObject > pLeftObj;
257 std::unique_ptr< EditTextObject > pCenterObj;
258 std::unique_ptr< EditTextObject > pRightObj;
261 OUString aCenterEntry;
262 OUString aRightEntry;
264 pLeftObj =
m_xWndLeft->GetEditEngine()->CreateTextObject();
265 pCenterObj =
m_xWndCenter->GetEditEngine()->CreateTextObject();
266 pRightObj =
m_xWndRight->GetEditEngine()->CreateTextObject();
271 for(sal_Int32
i = 0;
i <
nCount && !bFound; ++
i)
277 aLeftEntry = pLeftObj->GetText(0);
278 aCenterEntry = pCenterObj->GetText(0);
279 aRightEntry = pRightObj->GetText(0);
280 if(aLeftEntry.isEmpty() && aCenterEntry.isEmpty()
281 && aRightEntry.isEmpty())
291 aLeftEntry = pLeftObj->GetText(0);
292 aRightEntry = pRightObj->GetText(0);
293 if(aLeftEntry.isEmpty() && aRightEntry.isEmpty())
312 aLeftEntry = pLeftObj->GetText(0);
313 aRightEntry = pRightObj->GetText(0);
314 if(aLeftEntry.isEmpty() && aRightEntry.isEmpty())
316 if(pCenterObj->IsFieldObject())
338 if(aConfidentialEntry ==
m_xWndLeft->GetEditEngine()->GetText(0))
355 aLeftEntry = pLeftObj->GetText(0);
356 aRightEntry = pRightObj->GetText(0);
358 && aRightEntry.isEmpty())
380 aLeftEntry = pLeftObj->GetText(0);
396 if(aUserNameEntry ==
m_xWndLeft->GetEditEngine()->GetText(0))
411 if(aCreatedByEntry ==
m_xWndLeft->GetEditEngine()->GetText(0))
430 m_xLbDefined->set_active( sal::static_int_cast<sal_uInt16>( eSelectEntry ) );
435 if(!pEngine || !pTextObj)
438 bool bReturn =
false;
442 std::vector<sal_Int32> aPosList;
444 if(aPosList.size() == 2)
446 OUString aPageEntry(
m_xFtPage->get_label() +
" ");
448 aSel.
nEndPos = aPageEntry.getLength();
449 if(aPageEntry == pEngine->
GetText(aSel))
453 std::unique_ptr< EditTextObject > pPageObj = pEngine->
CreateTextObject(aSel);
454 if(pPageObj && pPageObj->IsFieldObject() )
475 bool bReturn =
false;
493 bool bReturn =
false;
510 std::unique_ptr< EditTextObject > pTextObj;
523 OUString aPageEntry(
m_xFtPage->get_label() +
" " );
524 m_xWndCenter->GetEditEngine()->SetTextCurrentDefaults(aPageEntry);
535 OUString aPageEntry(
m_xFtPage->get_label() +
" ");
536 m_xWndCenter->GetEditEngine()->SetTextCurrentDefaults(aPageEntry);
537 aSel.
nEndPos = aPageEntry.getLength();
541 OUString aPageOfEntry(
" " +
m_xFtOf->get_label() +
" ");
545 pTextObj =
m_xWndCenter->GetEditEngine()->CreateTextObject();
563 m_xWndLeft->GetEditEngine()->SetTextCurrentDefaults(aConfidentialEntry);
566 OUString aPageEntry(
m_xFtPage->get_label() +
" ");
567 m_xWndRight->GetEditEngine()->SetTextCurrentDefaults(aPageEntry);
580 OUString aPageEntry(
", " +
m_xFtPage->get_label() +
" ");
585 pTextObj =
m_xWndCenter->GetEditEngine()->CreateTextObject();
595 OUString(), SvxFileType::Var, SvxFileFormat::PathFull ),
EE_FEATURE_FIELD ) );
604 OUString aPageEntry(
m_xFtPage->get_label() +
" " );
605 m_xWndCenter->GetEditEngine()->SetTextCurrentDefaults(aPageEntry);
606 aSel.
nEndPos = aPageEntry.getLength();
610 OUString aCommaSpace(
", ");
614 pTextObj =
m_xWndCenter->GetEditEngine()->CreateTextObject();
625 OUString aPageEntry(
m_xFtPage->get_label() +
" " );
626 m_xWndCenter->GetEditEngine()->SetTextCurrentDefaults(aPageEntry);
627 aSel.
nEndPos = aPageEntry.getLength();
630 OUString aCommaSpace(
", ");
634 pTextObj =
m_xWndCenter->GetEditEngine()->CreateTextObject();
644 OUString aPageEntry(
m_xFtPage->get_label() +
" " );
645 m_xWndCenter->GetEditEngine()->SetTextCurrentDefaults(aPageEntry);
648 OUString(), SvxFileType::Var, SvxFileFormat::PathFull ),
EE_FEATURE_FIELD ) );
658 m_xWndLeft->GetEditEngine()->SetTextCurrentDefaults(aUserNameEntry);
659 OUString aPageEntry(
m_xFtPage->get_label() +
" ");
661 m_xWndCenter->GetEditEngine()->SetTextCurrentDefaults(aPageEntry);
673 m_xWndLeft->GetEditEngine()->SetTextCurrentDefaults(aCreatedByEntry);
675 OUString aPageEntry(
m_xFtPage->get_label() +
" " );
676 m_xWndRight->GetEditEngine()->SetTextCurrentDefaults(aPageEntry);
690 m_xWndLeft->GetEditEngine()->SetTextCurrentDefaults(OUString());
692 m_xWndCenter->GetEditEngine()->SetTextCurrentDefaults(OUString());
694 m_xWndRight->GetEditEngine()->SetTextCurrentDefaults(OUString());
701 m_bDropDownActive = !m_bDropDownActive;
703 osl_getSystemTime(&aNow);
704 m_nTimeToggled = sal_Int64(aNow.Seconds) * 1000000000 + aNow.Nanosec;
712 osl_getSystemTime(&aNow);
713 sal_Int64 nNow = sal_Int64(aNow.Seconds) * 1000000000 + aNow.Nanosec;
716 bool bDiscrepancy = m_xLbDefined->get_popup_shown() != m_bDropDownActive;
718 ListToggleHdl_Impl(*m_xLbDefined);
720 bool bFocusToTarget = !m_xLbDefined->get_popup_shown() && m_nTimeToggled != -1 && (nNow - m_nTimeToggled < 800000000);
721 ProcessDefinedListSel(eSel, !bFocusToTarget);
724 RemoveFromDefinedList();
728 ListToggleHdl_Impl(*m_xLbDefined);
736 if (&rBtn == m_xBtnText.get())
738 m_pEditFocus->SetCharAttributes();
742 if ( &rBtn == m_xBtnPage.get() )
744 else if ( &rBtn == m_xBtnLastPage.get() )
746 else if ( &rBtn == m_xBtnDate.get() )
748 else if ( &rBtn == m_xBtnTime.get() )
750 else if ( &rBtn == m_xBtnTable.get() )
753 InsertToDefinedList();
754 m_pEditFocus->GrabFocus();
762 if (rSelectedId ==
"title")
766 else if (rSelectedId ==
"filename")
769 OUString(), SvxFileType::Var, SvxFileFormat::NameAndExt ),
EE_FEATURE_FIELD ) );
771 else if (rSelectedId ==
"pathname")
774 OUString(), SvxFileType::Var, SvxFileFormat::PathFull ),
EE_FEATURE_FIELD ) );
788 return std::make_unique<ScFirstHeaderEditPage>( pPage, pController, *rCoreSet );
801 return std::make_unique<ScRightHeaderEditPage>( pPage, pController, *rCoreSet );
814 return std::make_unique<ScLeftHeaderEditPage>( pPage, pController, *rCoreSet );
827 return std::make_unique<ScFirstFooterEditPage>( pPage, pController, *rCoreSet );
840 return std::make_unique<ScRightFooterEditPage>( pPage, pController, *rCoreSet );
853 return std::make_unique<ScLeftFooterEditPage>( pPage, pController, *rCoreSet );
static bool GetLayoutRTL()
void GetPortions(sal_Int32 nPara, std::vector< sal_Int32 > &rList)
OUString GetText(LineEnd eEnd=LINEEND_LF) const
std::unique_ptr< EditTextObject > CreateTextObject()
virtual bool IsFieldObject() const=0
virtual const SvxFieldItem * GetField() const=0
static bool IsExtFileNameEntry(const EditTextObject *pTextObj)
std::unique_ptr< weld::Button > m_xBtnTime
void InsertToDefinedList()
std::unique_ptr< weld::Label > m_xFtCustomHF
std::unique_ptr< weld::Button > m_xBtnPage
void SetSelectDefinedList()
std::unique_ptr< weld::Label > m_xFtCustomized
TypedWhichId< ScPageHFItem > nWhich
std::unique_ptr< weld::Label > m_xFtNone
std::unique_ptr< ScEditWindow > m_xWndCenter
ScEditWindow * m_pEditFocus
void InitPreDefinedList()
std::unique_ptr< weld::Widget > m_xRight
std::unique_ptr< weld::Label > m_xFtPage
std::unique_ptr< weld::Widget > m_xLeft
void SetNumType(SvxNumType eNumType)
std::unique_ptr< weld::Button > m_xBtnText
virtual bool FillItemSet(SfxItemSet *rCoreSet) override
std::unique_ptr< ScEditWindow > m_xWndRight
std::unique_ptr< weld::Label > m_xFtCreatedBy
ScHFEditPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rCoreSet, TypedWhichId< ScPageHFItem > nWhich, bool bHeader)
std::unique_ptr< weld::Label > m_xFtDefinedHF
std::unique_ptr< ScEditWindow > m_xWndLeft
void ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling)
std::unique_ptr< weld::Label > m_xFtConfidential
std::unique_ptr< weld::MenuButton > m_xBtnFile
void RemoveFromDefinedList()
std::unique_ptr< weld::Button > m_xBtnLastPage
std::unique_ptr< weld::Label > m_xFtOf
virtual void Reset(const SfxItemSet *rCoreSet) override
static bool IsDateEntry(const EditTextObject *pTextObj)
std::unique_ptr< weld::Button > m_xBtnTable
std::unique_ptr< weld::CustomWeld > m_xWndRightWnd
std::unique_ptr< weld::Label > m_xFtOfQuestion
bool IsPageEntry(EditEngine *pEngine, const EditTextObject *pTextObj)
std::unique_ptr< weld::Button > m_xBtnDate
std::unique_ptr< weld::ComboBox > m_xLbDefined
virtual ~ScHFEditPage() override
std::unique_ptr< weld::CustomWeld > m_xWndLeftWnd
const EditTextObject * GetCenterArea() const
void SetLeftArea(const EditTextObject &rNew)
void SetCenterArea(const EditTextObject &rNew)
void SetRightArea(const EditTextObject &rNew)
const EditTextObject * GetLeftArea() const
const EditTextObject * GetRightArea() const
SfxItemPool * GetPool() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
OUString GetFirstName() const
OUString GetCompany() const
OUString GetLastName() const
const SvxFieldData * GetField() const
constexpr TypedWhichId< SvxFieldItem > EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
#define LINK(Instance, Class, Member)
#define SID_SCATTR_PAGE_FOOTERLEFT
#define SID_SCATTR_PAGE_HEADERFIRST
#define SID_SCATTR_PAGE_FOOTERFIRST
#define SID_SCATTR_PAGE_HEADERLEFT
#define SID_SCATTR_PAGE_FOOTERRIGHT
#define SID_SCATTR_PAGE_HEADERRIGHT
IMPL_LINK_NOARG(ScHFEditPage, ObjectSelectHdl, ScEditWindow &, void)
IMPL_LINK(ScHFEditPage, ClickHdl, weld::Button &, rBtn, void)