37 #include <osl/diagnose.h>
42 #include <section.hxx>
55 #include <strings.hrc>
56 #include <bitmaps.hlst>
60 #include <svx/dialogs.hrc>
63 #include <string_view>
69 OUString BuildBitmap(
bool bProtect,
bool bHidden)
72 return bHidden ? OUString(RID_BMP_PROT_HIDE) : OUString(RID_BMP_PROT_NO_HIDE);
73 return bHidden ? OUString(RID_BMP_HIDE) : OUString(RID_BMP_NO_HIDE);
76 OUString CollapseWhiteSpaces(
const OUString& sName)
78 const sal_Int32 nLen = sName.getLength();
80 OUStringBuffer
aBuf(nLen);
81 for (sal_Int32 i = 0;
i<nLen; )
87 while (i<nLen && sName[i]==cRef)
90 return aBuf.makeStringAndClear();
102 for (
size_t i = 0;
i<nCount;
i++)
123 if( !aTmpArr.empty() )
126 for(
const auto pSect : aTmpArr )
153 const ::sw::mark::IMark* pBkmk = *ppMark;
154 if( pBkmk->IsExpanded() )
193 void SetFile(std::u16string_view rFile);
194 void SetFilter(std::u16string_view rFilter);
205 { m_TempPasswd = rPasswd; }
209 : m_SectionData( rSect )
214 , m_bContent(m_SectionData.GetLinkFileName().isEmpty())
237 if( !rFile.empty() || !sSub.empty() )
248 if( !rFile.empty() || !sSub.empty() )
269 else if( !sSub.empty() )
274 if( !sNewFile.isEmpty() )
288 if( !rSubRegion.empty() || !sOldFileName.empty() )
294 if( !rSubRegion.empty() || !sOldFileName.empty() )
308 if( sLinkFile.isEmpty() )
325 if( !sLinkFile.isEmpty() )
334 , m_bSubRegionsFilled(
false)
336 , bDontCheckPasswd(true)
337 , m_xCurName(m_xBuilder->weld_entry(
"curname"))
338 , m_xTree(m_xBuilder->weld_tree_view(
"tree"))
339 , m_xFileCB(m_xBuilder->weld_check_button(
"link"))
340 , m_xDDECB(m_xBuilder->weld_check_button(
"dde"))
341 , m_xDDEFrame(m_xBuilder->weld_widget(
"ddedepend"))
342 , m_xFileNameFT(m_xBuilder->weld_label(
"filenameft"))
343 , m_xDDECommandFT(m_xBuilder->weld_label(
"ddeft"))
344 , m_xFileNameED(m_xBuilder->weld_entry(
"filename"))
345 , m_xFilePB(m_xBuilder->weld_button(
"file"))
346 , m_xSubRegionFT(m_xBuilder->weld_label(
"sectionft"))
347 , m_xSubRegionED(m_xBuilder->weld_combo_box(
"section"))
348 , m_xProtectCB(m_xBuilder->weld_check_button(
"protect"))
349 , m_xPasswdCB(m_xBuilder->weld_check_button(
"withpassword"))
350 , m_xPasswdPB(m_xBuilder->weld_button(
"password"))
351 , m_xHideCB(m_xBuilder->weld_check_button(
"hide"))
352 , m_xConditionFT(m_xBuilder->weld_label(
"conditionft"))
353 , m_xConditionED(new
ConditionEdit(m_xBuilder->weld_entry(
"condition")))
354 , m_xEditInReadonlyCB(m_xBuilder->weld_check_button(
"editinro"))
355 , m_xOK(m_xBuilder->weld_button(
"ok"))
356 , m_xOptionsPB(m_xBuilder->weld_button(
"options"))
357 , m_xDismiss(m_xBuilder->weld_button(
"remove"))
358 , m_xHideFrame(m_xBuilder->weld_widget(
"hideframe"))
390 m_xTree->set_selection_mode(SelectionMode::Multiple);
405 if (!
m_xTree->get_selected(
nullptr))
407 std::unique_ptr<weld::TreeIter> xIter(
m_xTree->make_iterator());
408 if (
m_xTree->get_iter_first(*xIter))
432 if (aPasswdDlg.run())
434 const OUString sNewPasswd(aPasswdDlg.GetPassword());
435 css::uno::Sequence <sal_Int8 > aNewPasswd;
446 VclMessageType::Info, VclButtonsType::Ok,
467 std::unique_ptr<weld::TreeIter> xIter(
m_xTree->make_iterator());
471 for (
size_t n = 0;
n < nCount;
n++ )
485 m_xTree->insert(
nullptr, -1, &sText, &sId,
nullptr,
nullptr,
false, xIter.get());
486 m_xTree->set_image(*xIter, sImage);
489 if (
m_xTree->iter_has_child(*xIter))
494 m_xTree->scroll_to_row(*xIter);
504 for(
const auto pSect : aTmpArr )
507 pFormat = pSect->GetFormat();
515 OUString sText(pSect->GetSectionName());
516 OUString sImage = BuildBitmap(pSect->IsProtect(), pSect->IsHidden());
518 m_xTree->insert(pEntry, -1, &sText, &sId,
nullptr,
nullptr,
false, xIter.get());
519 m_xTree->set_image(*xIter, sImage);
522 if (
m_xTree->iter_has_child(*xIter))
527 m_xTree->scroll_to_row(*xIter);
538 for (
size_t i = 0;
i < nCount;
i++ )
542 OSL_FAIL(
"SectionFormat not on the list" );
548 std::unique_ptr<weld::TreeIter> xIter(
m_xTree->make_iterator());
549 if (
m_xTree->get_iter_first(*xIter))
553 delete weld::fromId<SectRepr*>(
m_xTree->get_id(*xIter));
554 }
while (
m_xTree->iter_next(*xIter));
560 std::unique_ptr<weld::TreeIter> xIter(
m_xTree->make_iterator());
561 if (!
m_xTree->get_iter_first(*xIter))
571 m_xTree->scroll_to_row(*xIter);
575 }
while (
m_xTree->iter_next(*xIter));
582 bDontCheckPasswd =
true;
583 std::unique_ptr<weld::TreeIter> xIter(rBox.make_iterator());
584 bool bEntry = rBox.get_selected(xIter.get());
585 m_xHideCB->set_sensitive(
true);
587 m_xEditInReadonlyCB->set_sensitive(
true);
589 m_xProtectCB->set_sensitive(
true);
590 m_xFileCB->set_sensitive(
true);
591 css::uno::Sequence <sal_Int8> aCurPasswd;
592 if (1 < rBox.count_selected_rows())
600 bool bHiddenValid =
true;
601 bool bProtectValid =
true;
602 bool bConditionValid =
true;
604 bool bEditInReadonlyValid =
true;
605 bool bEditInReadonly =
true;
608 bool bProtect =
true;
611 bool bFileValid =
true;
613 bool bPasswdValid =
true;
616 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
620 sCondition =
rData.GetCondition();
621 bHidden =
rData.IsHidden();
622 bProtect =
rData.IsProtectFlag();
624 bEditInReadonly =
rData.IsEditInReadonlyFlag();
627 aCurPasswd =
rData.GetPassword();
631 if(sCondition !=
rData.GetCondition())
632 bConditionValid =
false;
633 bHiddenValid = (bHidden ==
rData.IsHidden());
634 bProtectValid = (bProtect ==
rData.IsProtectFlag());
636 bEditInReadonlyValid =
637 (bEditInReadonly ==
rData.IsEditInReadonlyFlag());
639 bFileValid = (bFile ==
641 bPasswdValid = (aCurPasswd ==
rData.GetPassword());
652 m_xEditInReadonlyCB->set_state(!bEditInReadonlyValid ?
TRISTATE_INDET :
659 m_xConditionED->set_text(sCondition);
662 m_xConditionFT->set_sensitive(
false);
663 m_xConditionED->set_sensitive(
false);
666 m_xCurName->set_sensitive(
false);
667 m_xDDECB->set_sensitive(
false);
668 m_xDDEFrame->set_sensitive(
false);
669 m_xOptionsPB->set_sensitive(
false);
670 bool bPasswdEnabled = m_xProtectCB->get_state() ==
TRISTATE_TRUE;
671 m_xPasswdCB->set_sensitive(bPasswdEnabled);
672 m_xPasswdPB->set_sensitive(bPasswdEnabled);
675 rBox.get_selected(xIter.get());
678 GetFirstEntryHdl(rBox);
682 m_xPasswdCB->set_active(aCurPasswd.hasElements());
686 m_xCurName->set_sensitive(
true);
687 m_xOptionsPB->set_sensitive(
true);
688 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
690 m_xConditionED->set_text(
rData.GetCondition());
691 m_xHideCB->set_sensitive(
true);
694 m_xConditionED->set_sensitive(bHide);
695 m_xConditionFT->set_sensitive(bHide);
696 m_xPasswdCB->set_active(
rData.GetPassword().hasElements());
698 m_xOK->set_sensitive(
true);
699 m_xPasswdCB->set_sensitive(
true);
700 m_xCurName->set_text(rBox.get_text(*xIter));
701 m_xCurName->set_sensitive(
true);
702 m_xDismiss->set_sensitive(
true);
703 const OUString aFile = pRepr->
GetFile();
705 m_xSubRegionED->clear();
706 m_xSubRegionED->append_text(
"");
707 m_bSubRegionsFilled =
false;
708 if( !aFile.isEmpty() || !sSub.isEmpty() )
710 m_xFileCB->set_active(
true);
711 m_xFileNameED->set_text(aFile);
712 m_xSubRegionED->set_entry_text(sSub);
717 m_xFileCB->set_active(
false);
718 m_xFileNameED->set_text(aFile);
719 m_xDDECB->set_sensitive(
false);
720 m_xDDECB->set_active(
false);
722 UseFileHdl(*m_xFileCB);
724 m_xProtectCB->set_state((
rData.IsProtectFlag())
726 m_xProtectCB->set_sensitive(
true);
729 m_xEditInReadonlyCB->set_state((
rData.IsEditInReadonlyFlag())
731 m_xEditInReadonlyCB->set_sensitive(
true);
733 bool bPasswdEnabled = m_xProtectCB->get_active();
734 m_xPasswdCB->set_sensitive(bPasswdEnabled);
735 m_xPasswdPB->set_sensitive(bPasswdEnabled);
737 bDontCheckPasswd =
false;
753 rSh.StartAllAction();
755 rSh.ResetSelect(
nullptr,
false );
757 std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
758 if (m_xTree->get_iter_first(*xIter))
762 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
768 size_t nNewPos = rDocFormats.
GetPos(pFormat);
769 if ( SIZE_MAX != nNewPos )
771 std::unique_ptr<SfxItemSet> pSet(pFormat->GetAttrSet().Clone(
false ));
772 if( pFormat->GetCol() != pRepr->
GetCol() )
773 pSet->Put( pRepr->
GetCol() );
775 std::unique_ptr<SvxBrushItem> aBrush(pFormat->makeBackgroundBrushItem(
false));
782 if( pFormat->GetEndAtTextEnd(
false) != pRepr->
GetEndNtAtEnd() )
785 if( pFormat->GetBalancedColumns() != pRepr->
GetBalance() )
788 if( pFormat->GetFrameDir() != *pRepr->
GetFrameDir() )
791 if( pFormat->GetLRSpace() != *pRepr->
GetLRSpace())
795 pSet->Count() ? pSet.get() : nullptr );
797 }
while (m_xTree->iter_next(*xIter));
800 for (SectReprs_t::reverse_iterator it = m_SectReprs.rbegin(), aEnd = m_SectReprs.rend(); it != aEnd; ++it)
802 assert(it->first == it->second->GetArrPos());
804 const size_t nNewPos = rDocFormats.
GetPos( pFormat );
805 if( SIZE_MAX != nNewPos )
806 rSh.DelSectionFormat( nNewPos );
822 if (!CheckPasswd(&rButton))
826 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
828 OUString aImage = BuildBitmap(bCheck,
TRISTATE_TRUE == m_xHideCB->get_state());
829 m_xTree->set_image(rEntry, aImage);
832 m_xPasswdCB->set_sensitive(bCheck);
833 m_xPasswdPB->set_sensitive(bCheck);
839 if (!CheckPasswd(&rButton))
841 m_xTree->selected_foreach([
this, &rButton](
weld::TreeIter& rEntry){
842 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
844 OUString aImage = BuildBitmap(
TRISTATE_TRUE == m_xProtectCB->get_state(),
846 m_xTree->set_image(rEntry, aImage);
850 m_xConditionED->set_sensitive(bHide);
851 m_xConditionFT->set_sensitive(bHide);
857 if (!CheckPasswd(&rButton))
859 m_xTree->selected_foreach([
this, &rButton](
weld::TreeIter& rEntry){
860 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
874 SectRepr*
const pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
879 std::unique_ptr<weld::TreeIter> xEntry(m_xTree->make_iterator());
880 bool bEntry(m_xTree->get_selected(xEntry.get()));
884 SectRepr*
const pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xEntry));
885 std::unique_ptr<weld::TreeIter> xRemove;
886 bool bRestart =
false;
889 m_SectReprs.insert(std::make_pair(pSectRepr->
GetArrPos(),
890 std::unique_ptr<SectRepr>(pSectRepr)));
891 if (m_xTree->iter_has_child(*xEntry))
893 std::unique_ptr<weld::TreeIter> xChild(m_xTree->make_iterator(xEntry.get()));
894 (
void)m_xTree->iter_children(*xChild);
895 std::unique_ptr<weld::TreeIter> xParent(m_xTree->make_iterator(xEntry.get()));
896 if (!m_xTree->iter_parent(*xParent))
903 std::unique_ptr<weld::TreeIter> xMove(m_xTree->make_iterator(xChild.get()));
904 bChild = m_xTree->iter_next_sibling(*xChild);
905 m_xTree->move_subtree(*xMove, xParent.get(), m_xTree->get_iter_index_in_parent(*xEntry));
908 xRemove = m_xTree->make_iterator(xEntry.get());
911 bEntry = m_xTree->get_iter_first(*xEntry);
913 bEntry = m_xTree->iter_next(*xEntry);
915 m_xTree->remove(*xRemove);
918 if (m_xTree->get_selected(
nullptr))
921 m_xConditionFT->set_sensitive(
false);
922 m_xConditionED->set_sensitive(
false);
923 m_xDismiss->set_sensitive(
false);
924 m_xCurName->set_sensitive(
false);
925 m_xProtectCB->set_sensitive(
false);
926 m_xPasswdCB->set_sensitive(
false);
927 m_xHideCB->set_sensitive(
false);
929 m_xEditInReadonlyCB->set_sensitive(
false);
932 m_xPasswdCB->set_active(
false);
934 m_xFileCB->set_active(
false);
937 UseFileHdl(*m_xFileCB);
943 if (!CheckPasswd(&rButton))
945 bool bMulti = 1 < m_xTree->count_selected_rows();
946 bool bFile = rButton.get_active();
947 if (m_xTree->get_selected(
nullptr))
950 SectRepr*
const pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
952 if( rButton.get_active() && bContent && rSh.HasSelection() )
955 VclMessageType::Question, VclButtonsType::YesNo,
957 if (
RET_NO == xQueryBox->run())
958 rButton.set_active(
false );
970 m_xDDECB->set_sensitive(bFile && !bMulti);
971 m_xDDEFrame->set_sensitive(bFile && !bMulti);
975 m_xFileNameED->grab_focus();
980 m_xDDECB->set_active(
false);
981 m_xSubRegionED->set_entry_text(OUString());
987 rButton.set_active(
false);
988 rButton.set_sensitive(
false);
989 m_xDDECB->set_active(
false);
990 m_xDDECB->set_sensitive(
false);
991 m_xDDEFrame->set_sensitive(
false);
1000 m_pDocInserter.reset(new ::sfx2::DocumentInserter(
m_xDialog.get(),
"swriter"));
1008 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1019 SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE> aSet( rSh.GetView().GetPool() );
1033 tools::Long nWidth = rSh.GetSectionWidth(*pFormat);
1042 if (
RET_OK != aTabDlg.run())
1045 const SfxItemSet* pOutSet = aTabDlg.GetOutputItemSet();
1046 if( !(pOutSet && pOutSet->
Count()) )
1052 RES_BACKGROUND,
false );
1054 RES_FTN_AT_TXTEND,
false );
1060 RES_FRAMEDIR,
false );
1062 RES_LR_SPACE,
false );
1075 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
1077 pRepr->
GetCol() = *pColItem;
1087 pRepr->
GetFrameDir()->SetValue(pFrameDirItem->GetValue());
1096 int nStartPos, nEndPos;
1097 rEdit.get_entry_selection_bounds(nStartPos, nEndPos);
1100 rEdit.select_entry_region(nStartPos, nEndPos);
1101 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1108 int nStartPos, nEndPos;
1113 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1114 m_xSubRegionED->clear();
1115 m_xSubRegionED->append_text(
"");
1116 m_bSubRegionsFilled =
false;
1117 if (m_xDDECB->get_active())
1135 SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium();
1149 if (!CheckPasswd(&rButton))
1151 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1155 bool bFile = m_xFileCB->get_active();
1157 bool bDDE = rButton.get_active();
1160 m_xFileNameFT->hide();
1161 m_xDDECommandFT->set_sensitive(
true);
1162 m_xDDECommandFT->show();
1163 m_xSubRegionFT->hide();
1164 m_xSubRegionED->hide();
1168 m_xFileNameED->set_text(OUString());
1169 rData.SetLinkFilePassword(OUString());
1175 m_xDDECommandFT->hide();
1176 m_xFileNameFT->set_sensitive(bFile);
1177 m_xFileNameFT->show();
1178 m_xSubRegionED->show();
1179 m_xSubRegionFT->show();
1180 m_xSubRegionED->set_sensitive(bFile);
1181 m_xSubRegionFT->set_sensitive(bFile);
1182 m_xSubRegionED->set_sensitive(bFile);
1187 rData.SetLinkFilePassword(OUString());
1188 m_xFileNameED->set_text(OUString());
1191 m_xFilePB->set_sensitive(bFile && !bDDE);
1203 bool bSet = bChange ? bChange :
m_xPasswdCB->get_active();
1212 aPasswdDlg.
ShowExtras(SfxShowExtras::CONFIRM);
1213 if (
RET_OK == aPasswdDlg.run())
1215 const OUString sNewPasswd(aPasswdDlg.GetPassword());
1216 if (aPasswdDlg.GetConfirm() == sNewPasswd)
1223 VclMessageType::Info, VclButtonsType::Ok,
1224 SwResId(STR_WRONG_PASSWD_REPEAT)));
1249 ChangePasswd(
false);
1263 std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
1264 if (m_xTree->get_selected(xIter.get()))
1266 const OUString
aName = m_xCurName->get_text();
1267 m_xTree->set_text(*xIter, aName);
1268 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
1271 m_xOK->set_sensitive(!aName.isEmpty());
1277 int nStartPos, nEndPos;
1284 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
1292 OUString sFileName, sFilterName, sPassword;
1295 std::unique_ptr<SfxMedium> pMedium(m_pDocInserter->CreateMedium(
"sglobal"));
1299 sFilterName = pMedium->GetFilter()->GetFilterName();
1300 if (
const SfxStringItem* pItem = pMedium->GetItemSet()->GetItemIfSet( SID_PASSWORD,
false ) )
1301 sPassword = pItem->GetValue();
1306 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1309 pSectRepr->
SetFile( sFileName );
1312 m_xFileNameED->set_text(pSectRepr->
GetFile());
1318 if (m_bSubRegionsFilled)
1323 OUString sFileName = m_xFileNameED->get_text();
1324 if(!sFileName.isEmpty())
1326 SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium();
1334 SfxMedium aMedium( sFileName, StreamMode::STD_READ );
1340 m_bSubRegionsFilled =
true;
1347 uno::Reference < embed::XStorage > xStg;
1351 std::vector<OUString>
aArr;
1353 if ( nFormat == SotClipboardFormatId::STARWRITER_60 || nFormat == SotClipboardFormatId::STARWRITERGLOB_60 ||
1354 nFormat == SotClipboardFormatId::STARWRITER_8 || nFormat == SotClipboardFormatId::STARWRITERGLOB_8)
1357 for (
auto const& it : aArr)
1366 "InsertSectionDialog",&rSet)
1395 if (rId ==
"section")
1397 else if (rId ==
"background")
1400 aSet.
Put (
SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_SELECTOR)));
1403 else if (rId ==
"columns")
1410 else if (rId ==
"indents")
1422 OSL_ENSURE(
m_pSectionData,
"SwInsertSectionTabDialog: no SectionData?");
1426 uno::Reference< frame::XDispatchRecorder > xRecorder =
1428 if ( xRecorder.is() )
1434 pCol->GetColumns().size()));
1448 const OUString sLinkFileName(
m_pSectionData->GetLinkFileName() );
1459 :
SfxTabPage(pPage, pController,
"modules/swriter/ui/sectionpage.ui",
"SectionPage", &rAttrSet)
1461 , m_xCurName(m_xBuilder->weld_entry_tree_view(
"sectionnames",
"sectionnames-entry",
1462 "sectionnames-list"))
1463 , m_xFileCB(m_xBuilder->weld_check_button(
"link"))
1464 , m_xDDECB(m_xBuilder->weld_check_button(
"dde"))
1465 , m_xDDECommandFT(m_xBuilder->weld_label(
"ddelabel"))
1466 , m_xFileNameFT(m_xBuilder->weld_label(
"filelabel"))
1467 , m_xFileNameED(m_xBuilder->weld_entry(
"filename"))
1468 , m_xFilePB(m_xBuilder->weld_button(
"selectfile"))
1469 , m_xSubRegionFT(m_xBuilder->weld_label(
"sectionlabel"))
1470 , m_xSubRegionED(m_xBuilder->weld_combo_box(
"sectionname"))
1471 , m_xProtectCB(m_xBuilder->weld_check_button(
"protect"))
1472 , m_xPasswdCB(m_xBuilder->weld_check_button(
"withpassword"))
1473 , m_xPasswdPB(m_xBuilder->weld_button(
"selectpassword"))
1474 , m_xHideCB(m_xBuilder->weld_check_button(
"hide"))
1475 , m_xConditionFT(m_xBuilder->weld_label(
"condlabel"))
1476 , m_xConditionED(new
ConditionEdit(m_xBuilder->weld_entry(
"withcond")))
1478 , m_xEditInReadonlyCB(m_xBuilder->weld_check_button(
"editable"))
1521 const OUString sSectionName(pSectionData->GetSectionName());
1523 m_xProtectCB->set_active( pSectionData->IsProtectFlag() );
1542 aSection.SetProtectFlag(bProtected);
1543 aSection.SetHidden(
m_xHideCB->get_active());
1553 bool bDDe =
m_xDDECB->get_active();
1554 if (
m_xFileCB->get_active() && (!sFileName.isEmpty() || !sSubRegion.isEmpty() || bDDe))
1559 aLinkFile = CollapseWhiteSpaces(sFileName);
1569 if(!sFileName.isEmpty())
1584 aSection.SetLinkFileName(aLinkFile);
1585 if (!aLinkFile.isEmpty())
1587 aSection.SetType(
m_xDDECB->get_active() ?
1603 return std::make_unique<SwInsertSectionTabPage>(pPage, pController, *rAttrSet);
1608 bool bHide = rBox.get_active();
1609 m_xConditionED->set_sensitive(bHide);
1610 m_xConditionFT->set_sensitive(bHide);
1615 bool bCheck = rBox.get_active();
1616 m_xPasswdCB->set_sensitive(bCheck);
1617 m_xPasswdPB->set_sensitive(bCheck);
1622 bool bSet = bChange ? bChange :
m_xPasswdCB->get_active();
1628 aPasswdDlg.
ShowExtras(SfxShowExtras::CONFIRM);
1631 const OUString sNewPasswd(aPasswdDlg.
GetPassword());
1639 VclMessageType::Info, VclButtonsType::Ok,
1640 SwResId(STR_WRONG_PASSWD_REPEAT)));
1654 ChangePasswd(
false);
1665 const OUString
aName = m_xCurName->get_active_text();
1666 GetDialogController()->GetOKButton().set_sensitive(!aName.isEmpty() &&
1667 m_xCurName->find_text(aName) == -1);
1672 if (rButton.get_active())
1674 if (m_pWrtSh->HasSelection())
1677 VclMessageType::Question, VclButtonsType::YesNo,
1679 if (
RET_NO == xQueryBox->run())
1680 rButton.set_active(
false);
1684 bool bFile = rButton.get_active();
1685 m_xFileNameFT->set_sensitive(bFile);
1686 m_xFileNameED->set_sensitive(bFile);
1687 m_xFilePB->set_sensitive(bFile);
1688 m_xSubRegionFT->set_sensitive(bFile);
1689 m_xSubRegionED->set_sensitive(bFile);
1690 m_xDDECommandFT->set_sensitive(bFile);
1691 m_xDDECB->set_sensitive(bFile);
1694 m_xFileNameED->grab_focus();
1695 m_xProtectCB->set_active(
true);
1696 ChangeProtectHdl(*m_xProtectCB);
1700 m_xDDECB->set_active(
false);
1707 m_pDocInserter.reset(new ::sfx2::DocumentInserter(
GetFrameWeld(),
"swriter"));
1713 bool bDDE = rButton.get_active();
1714 bool bFile = m_xFileCB->get_active();
1715 m_xFilePB->set_sensitive(!bDDE && bFile);
1718 m_xFileNameFT->hide();
1719 m_xDDECommandFT->set_sensitive(bDDE);
1720 m_xDDECommandFT->show();
1721 m_xSubRegionFT->hide();
1722 m_xSubRegionED->hide();
1723 m_xFileNameED->set_accessible_name(m_xDDECommandFT->get_label());
1727 m_xDDECommandFT->hide();
1728 m_xFileNameFT->set_sensitive(bFile);
1729 m_xFileNameFT->show();
1730 m_xSubRegionFT->show();
1731 m_xSubRegionED->show();
1732 m_xSubRegionED->set_sensitive(bFile);
1733 m_xFileNameED->set_accessible_name(m_xFileNameFT->get_label());
1741 std::unique_ptr<SfxMedium> pMedium(m_pDocInserter->CreateMedium(
"sglobal"));
1745 m_sFilterName = pMedium->GetFilter()->GetFilterName();
1746 if (
const SfxStringItem* pItem = pMedium->GetItemSet()->GetItemIfSet( SID_PASSWORD,
false ) )
1747 m_sFilePasswd = pItem->GetValue();
1755 m_sFilterName.clear();
1756 m_sFilePasswd.clear();
1761 :
SfxTabPage(pPage, pController,
"modules/swriter/ui/footnotesendnotestabpage.ui",
"FootnotesEndnotesTabPage", &rAttrSet)
1762 , m_xFootnoteNtAtTextEndCB(m_xBuilder->weld_check_button(
"ftnntattextend"))
1763 , m_xFootnoteNtNumCB(m_xBuilder->weld_check_button(
"ftnntnum"))
1764 , m_xFootnoteOffsetLbl(m_xBuilder->weld_label(
"ftnoffset_label"))
1765 , m_xFootnoteOffsetField(m_xBuilder->weld_spin_button(
"ftnoffset"))
1766 , m_xFootnoteNtNumFormatCB(m_xBuilder->weld_check_button(
"ftnntnumfmt"))
1767 , m_xFootnotePrefixFT(m_xBuilder->weld_label(
"ftnprefix_label"))
1768 , m_xFootnotePrefixED(m_xBuilder->weld_entry(
"ftnprefix"))
1770 , m_xFootnoteSuffixFT(m_xBuilder->weld_label(
"ftnsuffix_label"))
1771 , m_xFootnoteSuffixED(m_xBuilder->weld_entry(
"ftnsuffix"))
1772 , m_xEndNtAtTextEndCB(m_xBuilder->weld_check_button(
"endntattextend"))
1773 , m_xEndNtNumCB(m_xBuilder->weld_check_button(
"endntnum"))
1774 , m_xEndOffsetLbl(m_xBuilder->weld_label(
"endoffset_label"))
1775 , m_xEndOffsetField(m_xBuilder->weld_spin_button(
"endoffset"))
1776 , m_xEndNtNumFormatCB(m_xBuilder->weld_check_button(
"endntnumfmt"))
1777 , m_xEndPrefixFT(m_xBuilder->weld_label(
"endprefix_label"))
1778 , m_xEndPrefixED(m_xBuilder->weld_entry(
"endprefix"))
1780 , m_xEndSuffixFT(m_xBuilder->weld_label(
"endsuffix_label"))
1781 , m_xEndSuffixED(m_xBuilder->weld_entry(
"endsuffix"))
1809 switch( aFootnote.GetValue() )
1831 switch( aEnd.GetValue() )
1835 aEnd.SetPrefix(
m_xEndPrefixED->get_text().replaceAll(
"\\t",
"\t") );
1836 aEnd.SetSuffix(
m_xEndSuffixED->get_text().replaceAll(
"\\t",
"\t") );
1840 aEnd.SetOffset( static_cast< sal_uInt16 >(
m_xEndOffsetField->get_value()-1 ) );
1845 rSet->
Put( aFootnote );
1888 const sal_uInt16 eState = rAttr.
GetValue();
1940 return std::make_unique<SwSectionFootnoteEndTabPage>(pPage, pController, *rAttrSet);
1945 bool bFoot = m_xFootnoteNtAtTextEndCB.get() == &rBox || m_xFootnoteNtNumCB.get() == &rBox ||
1946 m_xFootnoteNtNumFormatCB.get() == &rBox ;
1957 pEndBox = m_xFootnoteNtAtTextEndCB.get();
1958 pNumBox = m_xFootnoteNtNumCB.get();
1959 pNumFormatBox = m_xFootnoteNtNumFormatCB.get();
1960 pNumViewBox = m_xFootnoteNumViewBox.get();
1961 pOffsetText = m_xFootnoteOffsetLbl.get();
1962 pOffsetField = m_xFootnoteOffsetField.get();
1963 pPrefixFT = m_xFootnotePrefixFT.get();
1964 pSuffixFT = m_xFootnoteSuffixFT.get();
1965 pPrefixED = m_xFootnotePrefixED.get();
1966 pSuffixED = m_xFootnoteSuffixED.get();
1970 pEndBox = m_xEndNtAtTextEndCB.get();
1971 pNumBox = m_xEndNtNumCB.get();
1972 pNumFormatBox = m_xEndNtNumFormatCB.get();
1973 pNumViewBox = m_xEndNumViewBox.get();
1974 pOffsetText = m_xEndOffsetLbl.get();
1975 pOffsetField = m_xEndOffsetField.get();
1976 pPrefixFT = m_xEndPrefixFT.get();
1977 pSuffixFT = m_xEndSuffixFT.get();
1978 pPrefixED = m_xEndPrefixED.get();
1979 pSuffixED = m_xEndSuffixED.get();
1984 bool bEnableNumFormat = bEnableNum && TRISTATE_TRUE == pNumFormatBox->
get_state();
2000 "FormatSectionDialog", &rSet)
2026 if (rId ==
"background")
2029 aSet.
Put (
SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_SELECTOR)));
2032 else if (rId ==
"columns")
2037 else if (rId ==
"indents")
2042 :
SfxTabPage(pPage, pController,
"modules/swriter/ui/indentpage.ui",
"IndentPage", &rAttrSet)
2043 , m_xBeforeMF(m_xBuilder->weld_metric_spin_button(
"before",
FieldUnit::
CM))
2044 , m_xAfterMF(m_xBuilder->weld_metric_spin_button(
"after",
FieldUnit::
CM))
2045 , m_xPreviewWin(new
weld::CustomWeld(*m_xBuilder,
"preview", m_aPreviewWin))
2063 rSet->
Put(aLRSpace);
2076 if ( eItemState >= SfxItemState::DEFAULT )
2096 return std::make_unique<SwSectionIndentTabPage>(pPage, pController, *rAttrSet);
2111 m_aPreviewWin.SetLeftMargin(m_xBeforeMF->denormalize(m_xBeforeMF->get_value(FieldUnit::TWIP)));
2112 m_aPreviewWin.SetRightMargin(m_xAfterMF->denormalize(m_xAfterMF->get_value(FieldUnit::TWIP)));
2113 m_aPreviewWin.Invalidate();
virtual ~SwEditRegionDlg() override
SfxViewFrame * GetViewFrame() const
#define LINK(Instance, Class, Member)
void SetFieldUnit(weld::MetricSpinButton &rField, FieldUnit eUnit, bool bAll)
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
tools::Long GetWidth() const
constexpr TypedWhichId< SwFormatEndAtTextEnd > RES_END_AT_TXTEND(118)
std::unique_ptr< weld::Label > m_xDDECommandFT
static void lcl_FillSubRegionList(SwWrtShell &rSh, weld::ComboBox &rSubRegions, weld::ComboBox *pAvailNames)
SwFormatFootnoteAtTextEnd & GetFootnoteNtAtEnd()
OUString GetConfirm() const
void SetAdjust(SvxAdjust eNew)
std::vector< SwSection * > SwSections
void RecurseList(const SwSectionFormat *pFormat, const weld::TreeIter *pIter)
#define FN_PARAM_REGION_EDIT_IN_READONLY
css::uno::Sequence< sal_Int8 > const & GetPassword() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
void SetType(SectionType const eNew)
void set_state(TriState eState)
void SetHidden(bool const bFlag)
SAL_DLLPRIVATE void SetProtectFlag(bool const bFlag)
virtual void PageCreated(const SfxAllItemSet &aSet)
static SfxAbstractDialogFactory * Create()
void SetLinkFileName(OUString const &rNew)
std::unique_ptr< SvxBrushItem > m_Brush
virtual ~SwInsertSectionTabPage() override
virtual bool FillItemSet(SfxItemSet *) override
constexpr TypedWhichId< SwFormatCol > RES_COL(109)
const SfxItemSet * GetOutputItemSet() const
css::uno::Sequence< sal_Int8 > m_aNewPasswd
IMPL_LINK_NOARG(SwEditRegionDlg, OkHdl, weld::Button &, void)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
const SwRect & GetAnyCurRect(CurRectType eType, const Point *pPt=nullptr, const css::uno::Reference< css::embed::XEmbeddedObject > &=css::uno::Reference< css::embed::XEmbeddedObject >()) const
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
void SetTempPasswd(const uno::Sequence< sal_Int8 > &rPasswd)
SwEditRegionDlg(weld::Window *pParent, SwWrtShell &rWrtSh)
std::shared_ptr< SvxLRSpaceItem > m_LRSpaceItem
SwSectionIndentTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rAttrSet)
-""- and with own numberformat
tools::Long GetRight() const
std::unique_ptr< ConditionEdit > m_xConditionED
void set_sensitive(bool bEnable)
const sal_Unicode cTokenSeparator
Provides access to the marks of a document.
SwSection const * InsertSection(SwSectionData &rNewData, SfxItemSet const *const =nullptr)
size_t FindArrPos(const SwSectionFormat *pFormat)
static SVL_DLLPUBLIC void GetHashPassword(css::uno::Sequence< sal_Int8 > &rPassHash, const char *pPass, sal_uInt32 nLen)
void RemoveTabPage(const OString &rName)
SwFormatEndAtTextEnd & GetEndNtAtEnd()
const ContentProperties & rData
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
std::unique_ptr< weld::EntryTreeView > m_xCurName
void SetSectionData(SwSectionData const &rSect)
void ChangePasswd(bool bChange)
void Done(bool bRemove=false)
SwSectionFormat * GetFormat()
SfxItemSet * GetInputSetImpl()
std::unique_ptr< weld::Entry > m_xFileNameED
virtual short run() override
static OUString decode(std::u16string_view rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
Of course Writer needs its own rectangles.
std::shared_ptr< T > make_shared(Args &&...args)
std::unique_ptr< weld::Entry > m_xFileNameED
virtual SvxBrushItem * Clone(SfxItemPool *pPool=nullptr) const override
virtual void set_text(const OUString &rText)=0
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
std::unique_ptr< weld::CheckButton > m_xFileCB
std::unique_ptr< ConditionEdit > m_xConditionED
virtual ~SwSectionIndentTabPage() override
const SwSection * GetCurrSection() const
std::unique_ptr< weld::CheckButton > m_xPasswdCB
Used by the UI to modify the document model.
OUString SwResId(TranslateId aId)
void SetWrtShell(SwWrtShell const &rSh)
IMPL_LINK(SwEditRegionDlg, GetFirstEntryHdl, weld::TreeView &, rBox, void)
const SwView & GetView() const
virtual CreateTabPage GetTabPageCreatorFunc(sal_uInt16 nId)=0
std::unique_ptr< weld::Button > m_xFilePB
std::unique_ptr< weld::TreeView > m_xTree
std::unique_ptr< weld::ComboBox > m_xSubRegionED
virtual SvxFrameDirectionItem * Clone(SfxItemPool *pPool=nullptr) const override
std::unique_ptr< weld::CheckButton > m_xEditInReadonlyCB
void Width(tools::Long nNew)
std::unique_ptr< weld::MetricSpinButton > m_xAfterMF
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
const OUString & GetSectionName() const
virtual void Reset(const SfxItemSet *) override
std::unique_ptr< weld::CheckButton > m_xHideCB
const SwSectionFormat & GetSectionFormat(size_t nFormat) const
static SotClipboardFormatId GetFormatID(css::uno::Reference< css::embed::XStorage > const &xStorage)
#define FN_PARAM_REGION_PROTECT
virtual bool FillItemSet(SfxItemSet *) override
SwInsertSectionTabDialog(weld::Window *pParent, const SfxItemSet &rSet, SwWrtShell &rSh)
SwFormatNoBalancedColumns m_Balance
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
SwFormatFootnoteAtTextEnd m_FootnoteNtAtEnd
virtual const_iterator_t getBookmarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of IBookmarks.
const SwSection * pCurrSect
virtual bool get_selection_bounds(int &rStartPos, int &rEndPos)=0
std::unique_ptr< weld::CheckButton > m_xProtectCB
std::unique_ptr< weld::Button > m_xOptionsPB
virtual void PageCreated(const OString &rId, SfxTabPage &rPage) override
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const OUString & GetSectionName() const
std::unique_ptr< weld::ComboBox > m_xSubRegionED
void SelectSection(std::u16string_view rSectionName)
uno::Sequence< sal_Int8 > & GetTempPasswd()
SVL_DLLPUBLIC Link< OUString *, bool > const & GetMaybeFileHdl()
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
SectRepr(size_t nPos, SwSection &rSect)
std::unique_ptr< weld::Entry > m_xCurName
std::unique_ptr< SvxBrushItem > & GetBackground()
SfxBindings & GetBindings()
std::unique_ptr< weld::CheckButton > m_xProtectCB
std::shared_ptr< SvxFrameDirectionItem > m_FrameDirItem
SwFormatEndAtTextEnd m_EndNtAtEnd
bool IsProtectFlag() const
tools::Long GetLeft() const
virtual void set_active(bool active)=0
virtual void select_region(int nStartPos, int nEndPos)=0
void ShowExtras(SfxShowExtras nExtras)
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
std::unique_ptr< weld::CheckButton > m_xFileCB
std::unique_ptr< weld::Widget > m_xHideFrame
std::shared_ptr< SvxLRSpaceItem > & GetLRSpace()
bool SelectNumberingType(SvxNumType nType)
std::unique_ptr< weld::Button > m_xDismiss
virtual void Reset(const SfxItemSet *) override
std::unique_ptr< weld::Button > m_xFilePB
virtual short Ok() override
Reader * SwGetReaderXML()
void SetCondition(OUString const &rNew)
void SetValue(bool const bTheValue)
SwDocShell * GetDocShell()
virtual OUString get_text() const =0
void SetSubRegion(std::u16string_view rSubRegion)
at end of the current text end
uno::Sequence< sal_Int8 > m_TempPasswd
std::unique_ptr< weld::MetricSpinButton > m_xBeforeMF
void SetContent(bool const bValue)
std::unique_ptr< weld::Label > m_xConditionFT
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
static void lcl_FillList(SwWrtShell &rSh, weld::ComboBox &rSubRegions, weld::ComboBox *pAvailNames, const SwSectionFormat *pNewFormat)
std::unique_ptr< weld::Button > m_xPasswdPB
void SetFile(std::u16string_view rFile)
SvxParaPrevWindow m_aPreviewWin
size_t GetSectionFormatCount() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
OUString toId(const void *pValue)
const OUString & GetLinkFileName() const
std::unique_ptr< weld::CheckButton > m_xEditInReadonlyCB
std::unique_ptr< weld::CheckButton > m_xHideCB
weld::Window * GetFrameWeld() const
const css::uno::Reference< css::frame::XDispatchRecorder > & GetRecorder() const
void SetLinkFilePassword(OUString const &rS)
#define FN_PARAM_REGION_CONDITION
static SVL_DLLPUBLIC bool CompareHashPassword(const css::uno::Sequence< sal_Int8 > &rOldPassHash, std::u16string_view sNewPass)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
virtual void PageCreated(const OString &rId, SfxTabPage &rPage) override
TriState get_state() const
css::uno::Reference< css::embed::XStorage > GetStorage(bool bCreateTempFile=true)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual ~SwSectionPropertyTabDialog() override
OUString GetUniqueSectionName(const OUString *pChkStr=nullptr) const
std::unique_ptr< weld::Button > m_xPasswdPB
SwSectionPropertyTabDialog(weld::Window *pParent, const SfxItemSet &rSet, SwWrtShell &rSh)
std::unique_ptr< weld::CheckButton > m_xDDECB
void ChangePasswd(bool bChange)
constexpr TypedWhichId< SwFormatNoBalancedColumns > RES_COLUMNBALANCE(119)
void SetEditInReadonlyFlag(bool const bFlag)
virtual const_iterator_t getBookmarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence the IBookmarks.
SwSectionData m_SectionData
virtual SvxLRSpaceItem * Clone(SfxItemPool *pPool=nullptr) const override
#define FN_PARAM_REGION_NAME
void AddTabPage(const OString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
Reference< XExecutableDialog > m_xDialog
const INetURLObject & GetURLObject() const
OUString GetPassword() const
SfxOkDialogController * GetDialogController() const
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
std::unique_ptr< weld::Button > m_xOK
SectionType GetType() const
std::unique_ptr< SwSectionData > m_pSectionData
std::shared_ptr< SvxFrameDirectionItem > & GetFrameDir()
void SetLastLine(SvxAdjust eNew)
void SetFilter(std::u16string_view rFilter)
static void lcl_ReadSections(SfxMedium &rMedium, weld::ComboBox &rBox)
-""- and with own number sequence
SwSectionData & GetSectionData()
virtual size_t GetSectionList(SfxMedium &rMedium, std::vector< OUString > &rStrings) const
void AppendItem(const SfxPoolItem &)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
void append_text(const OUString &rStr)
std::unique_ptr< weld::CheckButton > m_xDDECB
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLBACKGROUND)
SectionType GetType() const
virtual ~SwInsertSectionTabDialog() override
std::unique_ptr< weld::CheckButton > m_xPasswdCB
Frame is variable in Var-direction.
OUString GetSubRegion() const
SwFormatNoBalancedColumns & GetBalance()
bool CheckPasswd(weld::Toggleable *pBox=nullptr)
void SetWrtShell(SwWrtShell &rSh)
void Height(tools::Long nNew)
SwInsertSectionTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rAttrSet)
sal_uInt16 GetExportMode()
virtual bool get_active() const =0
constexpr TypedWhichId< SwFormatFootnoteAtTextEnd > RES_FTN_AT_TXTEND(117)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
#define FN_PARAM_REGION_HIDDEN
void SetCurPageId(const OString &rName)
bool m_bDetectedRangeSegmentation false
void SetPassword(css::uno::Sequence< sal_Int8 > const &rNew)
SVL_DLLPUBLIC OUString SmartRel2Abs(INetURLObject const &rTheBaseURIRef, OUString const &rTheRelURIRef, Link< OUString *, bool > const &rMaybeFileHdl=Link< OUString *, bool >(), bool bCheckFileExists=true, bool bIgnoreFragment=false, INetURLObject::EncodeMechanism eEncodeMechanism=INetURLObject::EncodeMechanism::WasEncoded, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
void SetSectionName(OUString const &rName)
SfxMedium * GetMedium() const