LibreOffice Module sw (master) 1
uiregionsw.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 <hintids.hxx>
21#include <regionsw.hxx>
22#include <svl/urihelper.hxx>
24#include <vcl/svapp.hxx>
25#include <vcl/weld.hxx>
26#include <svl/stritem.hxx>
27#include <svl/eitem.hxx>
28#include <sfx2/passwd.hxx>
29#include <sfx2/docfilt.hxx>
30#include <sfx2/request.hxx>
31#include <sfx2/docfile.hxx>
32#include <sfx2/linkmgr.hxx>
33#include <sfx2/docinsert.hxx>
35#include <editeng/sizeitem.hxx>
36#include <svtools/htmlcfg.hxx>
37#include <osl/diagnose.h>
38#include <o3tl/string_view.hxx>
39#include <comphelper/lok.hxx>
40
41#include <uitool.hxx>
42#include <IMark.hxx>
43#include <section.hxx>
44#include <docary.hxx>
45#include <doc.hxx>
46#include <wdocsh.hxx>
47#include <view.hxx>
48#include <wrtsh.hxx>
49#include <column.hxx>
50#include <fmtclbl.hxx>
51#include <fmtfsize.hxx>
52#include <frmatr.hxx>
53#include <shellio.hxx>
54
55#include <cmdid.h>
56#include <strings.hrc>
57#include <bitmaps.hlst>
58#include <sfx2/bindings.hxx>
59#include <sfx2/sfxdlg.hxx>
60#include <sfx2/viewfrm.hxx>
61#include <svx/dialogs.hrc>
62#include <svx/flagsdef.hxx>
63#include <memory>
64#include <string_view>
65
66using namespace ::com::sun::star;
67
68namespace {
69
70OUString BuildBitmap(bool bProtect, bool bHidden)
71{
72 if (bProtect)
73 return bHidden ? OUString(RID_BMP_PROT_HIDE) : OUString(RID_BMP_PROT_NO_HIDE);
74 return bHidden ? OUString(RID_BMP_HIDE) : OUString(RID_BMP_NO_HIDE);
75}
76
77OUString CollapseWhiteSpaces(std::u16string_view sName)
78{
79 const sal_Int32 nLen = sName.size();
80 const sal_Unicode cRef = ' ';
81 OUStringBuffer aBuf(nLen);
82 for (sal_Int32 i = 0; i<nLen; )
83 {
84 const sal_Unicode cCur = sName[i++];
85 aBuf.append(cCur);
86 if (cCur!=cRef)
87 continue;
88 while (i<nLen && sName[i]==cRef)
89 ++i;
90 }
91 return aBuf.makeStringAndClear();
92}
93
94}
95
96static void lcl_ReadSections( SfxMedium& rMedium, weld::ComboBox& rBox );
97
98static void lcl_FillList( SwWrtShell& rSh, weld::ComboBox& rSubRegions, weld::ComboBox* pAvailNames, const SwSectionFormat* pNewFormat )
99{
100 if( !pNewFormat )
101 {
102 const size_t nCount = rSh.GetSectionFormatCount();
103 for (size_t i = 0; i<nCount; i++)
104 {
105 SectionType eTmpType;
106 const SwSectionFormat* pFormat = &rSh.GetSectionFormat(i);
107 if( !pFormat->GetParent() &&
108 pFormat->IsInNodesArr() &&
109 (eTmpType = pFormat->GetSection()->GetType()) != SectionType::ToxContent
110 && SectionType::ToxHeader != eTmpType )
111 {
112 const OUString sString(pFormat->GetSection()->GetSectionName());
113 if (pAvailNames)
114 pAvailNames->append_text(sString);
115 rSubRegions.append_text(sString);
116 lcl_FillList( rSh, rSubRegions, pAvailNames, pFormat );
117 }
118 }
119 }
120 else
121 {
122 SwSections aTmpArr;
123 pNewFormat->GetChildSections(aTmpArr, SectionSort::Pos);
124 if( !aTmpArr.empty() )
125 {
126 SectionType eTmpType;
127 for( const auto pSect : aTmpArr )
128 {
129 const SwSectionFormat* pFormat = pSect->GetFormat();
130 if( pFormat->IsInNodesArr()&&
131 (eTmpType = pFormat->GetSection()->GetType()) != SectionType::ToxContent
132 && SectionType::ToxHeader != eTmpType )
133 {
134 const OUString sString(pFormat->GetSection()->GetSectionName());
135 if (pAvailNames)
136 pAvailNames->append_text(sString);
137 rSubRegions.append_text(sString);
138 lcl_FillList( rSh, rSubRegions, pAvailNames, pFormat );
139 }
140 }
141 }
142 }
143}
144
145static void lcl_FillSubRegionList( SwWrtShell& rSh, weld::ComboBox& rSubRegions, weld::ComboBox* pAvailNames )
146{
147 rSubRegions.clear();
148 lcl_FillList( rSh, rSubRegions, pAvailNames, nullptr );
149 IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
150 for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getBookmarksBegin();
151 ppMark != pMarkAccess->getBookmarksEnd();
152 ++ppMark)
153 {
154 const ::sw::mark::IMark* pBkmk = *ppMark;
155 if( pBkmk->IsExpanded() )
156 rSubRegions.append_text( pBkmk->GetName() );
157 }
158}
159
160// user data class for region information
162{
163private:
166 std::unique_ptr<SvxBrushItem> m_Brush;
170 std::shared_ptr<SvxFrameDirectionItem> m_FrameDirItem;
171 std::shared_ptr<SvxLRSpaceItem> m_LRSpaceItem;
172 const size_t m_nArrPos;
173 // shows, if maybe textcontent is in the region
174 bool m_bContent : 1;
175 // for multiselection, mark at first, then work with TreeListBox!
176 bool m_bSelected : 1;
177 uno::Sequence<sal_Int8> m_TempPasswd;
178
179public:
180 SectRepr(size_t nPos, SwSection& rSect);
181
183 SwFormatCol& GetCol() { return m_Col; }
184 std::unique_ptr<SvxBrushItem>& GetBackground() { return m_Brush; }
188 std::shared_ptr<SvxFrameDirectionItem>& GetFrameDir() { return m_FrameDirItem; }
189 std::shared_ptr<SvxLRSpaceItem>& GetLRSpace() { return m_LRSpaceItem; }
190
191 size_t GetArrPos() const { return m_nArrPos; }
192 OUString GetFile() const;
193 OUString GetSubRegion() const;
194 void SetFile(std::u16string_view rFile);
195 void SetFilter(std::u16string_view rFilter);
196 void SetSubRegion(std::u16string_view rSubRegion);
197
198 bool IsContent() const { return m_bContent; }
199 void SetContent(bool const bValue) { m_bContent = bValue; }
200
201 void SetSelected() { m_bSelected = true; }
202 bool IsSelected() const { return m_bSelected; }
203
204 uno::Sequence<sal_Int8> & GetTempPasswd() { return m_TempPasswd; }
205 void SetTempPasswd(const uno::Sequence<sal_Int8> & rPasswd)
206 { m_TempPasswd = rPasswd; }
207};
208
209SectRepr::SectRepr( size_t nPos, SwSection& rSect )
210 : m_SectionData( rSect )
211 , m_Brush(std::make_unique<SvxBrushItem>(RES_BACKGROUND))
213 , m_LRSpaceItem(std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE))
214 , m_nArrPos(nPos)
215 , m_bContent(m_SectionData.GetLinkFileName().isEmpty())
216 , m_bSelected(false)
217{
218 SwSectionFormat *pFormat = rSect.GetFormat();
219 if( pFormat )
220 {
221 m_Col = pFormat->GetCol();
222 m_Brush = pFormat->makeBackgroundBrushItem();
224 m_EndNtAtEnd = pFormat->GetEndAtTextEnd();
226 m_FrameDirItem.reset(pFormat->GetFrameDir().Clone());
227 m_LRSpaceItem.reset(pFormat->GetLRSpace().Clone());
228 }
229}
230
231void SectRepr::SetFile( std::u16string_view rFile )
232{
233 OUString sNewFile( INetURLObject::decode( rFile,
235 const OUString sOldFileName( m_SectionData.GetLinkFileName() );
236 const std::u16string_view sSub( o3tl::getToken(sOldFileName, 2, sfx2::cTokenSeparator ) );
237
238 if( !rFile.empty() || !sSub.empty() )
239 {
240 sNewFile += OUStringChar(sfx2::cTokenSeparator);
241 if( !rFile.empty() ) // Filter only with FileName
242 sNewFile += o3tl::getToken(sOldFileName, 1, sfx2::cTokenSeparator );
243
244 sNewFile += OUStringChar(sfx2::cTokenSeparator) + sSub;
245 }
246
247 m_SectionData.SetLinkFileName( sNewFile );
248
249 if( !rFile.empty() || !sSub.empty() )
250 {
252 }
253 else
254 {
256 }
257}
258
259void SectRepr::SetFilter( std::u16string_view rFilter )
260{
261 OUString sNewFile;
262 const OUString sOldFileName( m_SectionData.GetLinkFileName() );
263 sal_Int32 nIdx{ 0 };
264 const std::u16string_view sFile( o3tl::getToken(sOldFileName, 0, sfx2::cTokenSeparator, nIdx ) ); // token 0
265 const std::u16string_view sSub( o3tl::getToken(sOldFileName, 1, sfx2::cTokenSeparator, nIdx ) ); // token 2
266
267 if( !sFile.empty() )
268 sNewFile = sFile + OUStringChar(sfx2::cTokenSeparator) +
269 rFilter + OUStringChar(sfx2::cTokenSeparator) + sSub;
270 else if( !sSub.empty() )
271 sNewFile = OUStringChar(sfx2::cTokenSeparator) + OUStringChar(sfx2::cTokenSeparator) + sSub;
272
273 m_SectionData.SetLinkFileName( sNewFile );
274
275 if( !sNewFile.isEmpty() )
276 {
278 }
279}
280
281void SectRepr::SetSubRegion(std::u16string_view rSubRegion)
282{
283 OUString sNewFile;
284 sal_Int32 n(0);
285 const OUString sLinkFileName(m_SectionData.GetLinkFileName());
286 const std::u16string_view sOldFileName( o3tl::getToken(sLinkFileName, 0, sfx2::cTokenSeparator, n ) );
287 const std::u16string_view sFilter( o3tl::getToken(sLinkFileName, 0, sfx2::cTokenSeparator, n ) );
288
289 if( !rSubRegion.empty() || !sOldFileName.empty() )
290 sNewFile = sOldFileName + OUStringChar(sfx2::cTokenSeparator) +
291 sFilter + OUStringChar(sfx2::cTokenSeparator) + rSubRegion;
292
293 m_SectionData.SetLinkFileName( sNewFile );
294
295 if( !rSubRegion.empty() || !sOldFileName.empty() )
296 {
298 }
299 else
300 {
302 }
303}
304
305OUString SectRepr::GetFile() const
306{
307 const OUString sLinkFile( m_SectionData.GetLinkFileName() );
308
309 if( sLinkFile.isEmpty() )
310 {
311 return sLinkFile;
312 }
314 {
315 sal_Int32 n = 0;
316 return sLinkFile.replaceFirst( OUStringChar(sfx2::cTokenSeparator), " ", &n )
317 .replaceFirst( OUStringChar(sfx2::cTokenSeparator), " ", &n );
318 }
321}
322
324{
325 const OUString sLinkFile( m_SectionData.GetLinkFileName() );
326 if( !sLinkFile.isEmpty() )
327 return sLinkFile.getToken( 2, sfx2::cTokenSeparator );
328 return sLinkFile;
329}
330
331// dialog edit regions
333 : SfxDialogController(pParent, "modules/swriter/ui/editsectiondialog.ui",
334 "EditSectionDialog")
335 , m_bSubRegionsFilled(false)
336 , m_rSh(rWrtSh)
337 , m_bDontCheckPasswd(true)
338 , m_xCurName(m_xBuilder->weld_entry("curname"))
339 , m_xTree(m_xBuilder->weld_tree_view("tree"))
340 , m_xFileCB(m_xBuilder->weld_check_button("link"))
341 , m_xDDECB(m_xBuilder->weld_check_button("dde"))
342 , m_xDDEFrame(m_xBuilder->weld_widget("ddedepend"))
343 , m_xFileNameFT(m_xBuilder->weld_label("filenameft"))
344 , m_xDDECommandFT(m_xBuilder->weld_label("ddeft"))
345 , m_xFileNameED(m_xBuilder->weld_entry("filename"))
346 , m_xFilePB(m_xBuilder->weld_button("file"))
347 , m_xSubRegionFT(m_xBuilder->weld_label("sectionft"))
348 , m_xSubRegionED(m_xBuilder->weld_combo_box("section"))
349 , m_xProtectCB(m_xBuilder->weld_check_button("protect"))
350 , m_xPasswdCB(m_xBuilder->weld_check_button("withpassword"))
351 , m_xPasswdPB(m_xBuilder->weld_button("password"))
352 , m_xHideCB(m_xBuilder->weld_check_button("hide"))
353 , m_xConditionFT(m_xBuilder->weld_label("conditionft"))
354 , m_xConditionED(new ConditionEdit(m_xBuilder->weld_entry("condition")))
355 , m_xEditInReadonlyCB(m_xBuilder->weld_check_button("editinro"))
356 , m_xOK(m_xBuilder->weld_button("ok"))
357 , m_xOptionsPB(m_xBuilder->weld_button("options"))
358 , m_xDismiss(m_xBuilder->weld_button("remove"))
359 , m_xHideFrame(m_xBuilder->weld_widget("hideframe"))
360{
361 m_xTree->set_size_request(-1, m_xTree->get_height_rows(16));
362 m_xFileCB->set_state(TRISTATE_FALSE);
363 m_xSubRegionED->make_sorted();
364 m_xProtectCB->set_state(TRISTATE_FALSE);
365 m_xHideCB->set_state(TRISTATE_FALSE);
366 // edit in readonly sections
368
369 bool bWeb = dynamic_cast<SwWebDocShell*>( m_rSh.GetView().GetDocShell() ) != nullptr;
370
371 m_xTree->connect_changed(LINK(this, SwEditRegionDlg, GetFirstEntryHdl));
372 m_xCurName->connect_changed(LINK(this, SwEditRegionDlg, NameEditHdl));
373 m_xConditionED->connect_changed( LINK( this, SwEditRegionDlg, ConditionEditHdl));
374 m_xOK->connect_clicked( LINK( this, SwEditRegionDlg, OkHdl));
375 m_xPasswdCB->connect_toggled(LINK(this, SwEditRegionDlg, TogglePasswdHdl));
376 m_xPasswdPB->connect_clicked(LINK(this, SwEditRegionDlg, ChangePasswdHdl));
377 m_xHideCB->connect_toggled(LINK(this, SwEditRegionDlg, ChangeHideHdl));
378 // edit in readonly sections
379 m_xEditInReadonlyCB->connect_toggled(LINK(this, SwEditRegionDlg, ChangeEditInReadonlyHdl));
380
381 m_xOptionsPB->connect_clicked(LINK(this, SwEditRegionDlg, OptionsHdl));
382 m_xProtectCB->connect_toggled(LINK(this, SwEditRegionDlg, ChangeProtectHdl));
383 m_xDismiss->connect_clicked( LINK( this, SwEditRegionDlg, ChangeDismissHdl));
384 m_xFileCB->connect_toggled(LINK(this, SwEditRegionDlg, UseFileHdl));
385 m_xFilePB->connect_clicked(LINK(this, SwEditRegionDlg, FileSearchHdl));
386 m_xFileNameED->connect_changed(LINK(this, SwEditRegionDlg, FileNameEntryHdl));
387 m_xSubRegionED->connect_changed(LINK(this, SwEditRegionDlg, FileNameComboBoxHdl));
388 m_xSubRegionED->connect_popup_toggled(LINK(this, SwEditRegionDlg, SubRegionEventHdl));
389 m_xSubRegionED->set_entry_completion(true, true);
390
391 m_xTree->set_selection_mode(SelectionMode::Multiple);
392
393 if (bWeb)
394 {
395 m_xDDECB->hide();
396 m_xHideFrame->hide();
397 m_xPasswdCB->hide();
398 }
399
400 m_xDDECB->connect_toggled(LINK(this, SwEditRegionDlg, DDEHdl));
401
403 RecurseList( nullptr, nullptr );
404
405 // if the cursor is not in a region the first one will always be selected
406 if (!m_xTree->get_selected(nullptr))
407 {
408 std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
409 if (m_xTree->get_iter_first(*xIter))
410 {
411 m_xTree->select(*xIter);
412 GetFirstEntryHdl(*m_xTree);
413 }
414 }
415
416 m_xTree->show();
417 m_bDontCheckPasswd = false;
418
420 {
421 m_xDDECB->hide();
422 m_xDDECommandFT->hide();
423 m_xFileNameFT->hide();
424 m_xFileNameED->hide();
425 m_xFilePB->hide();
426 }
427}
428
430{
432 return true;
433 bool bRet = true;
434
435 m_xTree->selected_foreach([this, &bRet](weld::TreeIter& rEntry){
436 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
437 if (!pRepr->GetTempPasswd().hasElements()
438 && pRepr->GetSectionData().GetPassword().hasElements())
439 {
440 SfxPasswordDialog aPasswdDlg(m_xDialog.get());
441 bRet = false;
442 if (aPasswdDlg.run())
443 {
444 const OUString sNewPasswd(aPasswdDlg.GetPassword());
445 css::uno::Sequence <sal_Int8 > aNewPasswd;
446 SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
448 pRepr->GetSectionData().GetPassword(), sNewPasswd))
449 {
450 pRepr->SetTempPasswd(aNewPasswd);
451 bRet = true;
452 }
453 else
454 {
455 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
456 VclMessageType::Info, VclButtonsType::Ok,
457 SwResId(STR_WRONG_PASSWORD)));
458 xInfoBox->run();
459 }
460 }
461 }
462 return false;
463 });
464 if (!bRet && pBox)
465 {
466 //reset old button state
467 if (pBox->get_state() != TRISTATE_INDET)
468 pBox->set_active(!pBox->get_active());
469 }
470
471 return bRet;
472}
473
474// recursively look for child-sections
476{
477 std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
478 if (!pFormat)
479 {
480 const size_t nCount=m_rSh.GetSectionFormatCount();
481 for ( size_t n = 0; n < nCount; n++ )
482 {
483 SectionType eTmpType;
484 if( !( pFormat = &m_rSh.GetSectionFormat(n))->GetParent() &&
485 pFormat->IsInNodesArr() &&
486 (eTmpType = pFormat->GetSection()->GetType()) != SectionType::ToxContent
487 && SectionType::ToxHeader != eTmpType )
488 {
489 SwSection *pSect = pFormat->GetSection();
490 SectRepr* pSectRepr = new SectRepr( n, *pSect );
491
492 OUString sText(pSect->GetSectionName());
493 OUString sImage(BuildBitmap(pSect->IsProtect(),pSect->IsHidden()));
494 OUString sId(weld::toId(pSectRepr));
495 m_xTree->insert(nullptr, -1, &sText, &sId, nullptr, nullptr, false, xIter.get());
496 m_xTree->set_image(*xIter, sImage);
497
498 RecurseList(pFormat, xIter.get());
499 if (m_xTree->iter_has_child(*xIter))
500 m_xTree->expand_row(*xIter);
501 if (m_pCurrSect==pSect)
502 {
503 m_xTree->select(*xIter);
504 m_xTree->scroll_to_row(*xIter);
505 GetFirstEntryHdl(*m_xTree);
506 }
507 }
508 }
509 }
510 else
511 {
512 SwSections aTmpArr;
513 pFormat->GetChildSections(aTmpArr, SectionSort::Pos);
514 for( const auto pSect : aTmpArr )
515 {
516 SectionType eTmpType;
517 pFormat = pSect->GetFormat();
518 if( pFormat->IsInNodesArr() &&
519 (eTmpType = pFormat->GetSection()->GetType()) != SectionType::ToxContent
520 && SectionType::ToxHeader != eTmpType )
521 {
522 SectRepr* pSectRepr=new SectRepr(
523 FindArrPos( pSect->GetFormat() ), *pSect );
524
525 OUString sText(pSect->GetSectionName());
526 OUString sImage = BuildBitmap(pSect->IsProtect(), pSect->IsHidden());
527 OUString sId(weld::toId(pSectRepr));
528 m_xTree->insert(pEntry, -1, &sText, &sId, nullptr, nullptr, false, xIter.get());
529 m_xTree->set_image(*xIter, sImage);
530
531 RecurseList(pSect->GetFormat(), xIter.get());
532 if (m_xTree->iter_has_child(*xIter))
533 m_xTree->expand_row(*xIter);
534 if (m_pCurrSect==pSect)
535 {
536 m_xTree->select(*xIter);
537 m_xTree->scroll_to_row(*xIter);
538 GetFirstEntryHdl(*m_xTree);
539 }
540 }
541 }
542 }
543}
544
546{
547 const size_t nCount=m_rSh.GetSectionFormatCount();
548 for ( size_t i = 0; i < nCount; i++ )
549 if ( pFormat == &m_rSh.GetSectionFormat(i) )
550 return i;
551
552 OSL_FAIL("SectionFormat not on the list" );
553 return SIZE_MAX;
554}
555
557{
558 std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
559 if (m_xTree->get_iter_first(*xIter))
560 {
561 do
562 {
563 delete weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
564 } while (m_xTree->iter_next(*xIter));
565 }
566}
567
568void SwEditRegionDlg::SelectSection(std::u16string_view rSectionName)
569{
570 std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
571 if (!m_xTree->get_iter_first(*xIter))
572 return;
573
574 do
575 {
576 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
577 if (pRepr->GetSectionData().GetSectionName() == rSectionName)
578 {
579 m_xTree->unselect_all();
580 m_xTree->select(*xIter);
581 m_xTree->scroll_to_row(*xIter);
582 GetFirstEntryHdl(*m_xTree);
583 break;
584 }
585 } while (m_xTree->iter_next(*xIter));
586}
587
588// selected entry in TreeListBox is showed in Edit window in case of
589// multiselection some controls are disabled
590IMPL_LINK(SwEditRegionDlg, GetFirstEntryHdl, weld::TreeView&, rBox, void)
591{
592 m_bDontCheckPasswd = true;
593 std::unique_ptr<weld::TreeIter> xIter(rBox.make_iterator());
594 bool bEntry = rBox.get_selected(xIter.get());
595 m_xHideCB->set_sensitive(true);
596 // edit in readonly sections
597 m_xEditInReadonlyCB->set_sensitive(true);
598
599 m_xProtectCB->set_sensitive(true);
600 m_xFileCB->set_sensitive(true);
601 css::uno::Sequence <sal_Int8> aCurPasswd;
602 if (1 < rBox.count_selected_rows())
603 {
604 m_xHideCB->set_state(TRISTATE_INDET);
605 m_xProtectCB->set_state(TRISTATE_INDET);
606 // edit in readonly sections
607 m_xEditInReadonlyCB->set_state(TRISTATE_INDET);
608 m_xFileCB->set_state(TRISTATE_INDET);
609
610 bool bHiddenValid = true;
611 bool bProtectValid = true;
612 bool bConditionValid = true;
613 // edit in readonly sections
614 bool bEditInReadonlyValid = true;
615 bool bEditInReadonly = true;
616
617 bool bHidden = true;
618 bool bProtect = true;
619 OUString sCondition;
620 bool bFirst = true;
621 bool bFileValid = true;
622 bool bFile = true;
623 bool bPasswdValid = true;
624
625 m_xTree->selected_foreach([&](weld::TreeIter& rEntry){
626 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
627 SwSectionData const& rData( pRepr->GetSectionData() );
628 if(bFirst)
629 {
630 sCondition = rData.GetCondition();
631 bHidden = rData.IsHidden();
632 bProtect = rData.IsProtectFlag();
633 // edit in readonly sections
634 bEditInReadonly = rData.IsEditInReadonlyFlag();
635
636 bFile = (rData.GetType() != SectionType::Content);
637 aCurPasswd = rData.GetPassword();
638 }
639 else
640 {
641 if(sCondition != rData.GetCondition())
642 bConditionValid = false;
643 bHiddenValid = (bHidden == rData.IsHidden());
644 bProtectValid = (bProtect == rData.IsProtectFlag());
645 // edit in readonly sections
646 bEditInReadonlyValid =
647 (bEditInReadonly == rData.IsEditInReadonlyFlag());
648
649 bFileValid = (bFile ==
650 (rData.GetType() != SectionType::Content));
651 bPasswdValid = (aCurPasswd == rData.GetPassword());
652 }
653 bFirst = false;
654 return false;
655 });
656
657 m_xHideCB->set_state(!bHiddenValid ? TRISTATE_INDET :
658 bHidden ? TRISTATE_TRUE : TRISTATE_FALSE);
659 m_xProtectCB->set_state(!bProtectValid ? TRISTATE_INDET :
660 bProtect ? TRISTATE_TRUE : TRISTATE_FALSE);
661 // edit in readonly sections
662 m_xEditInReadonlyCB->set_state(!bEditInReadonlyValid ? TRISTATE_INDET :
663 bEditInReadonly ? TRISTATE_TRUE : TRISTATE_FALSE);
664
665 m_xFileCB->set_state(!bFileValid ? TRISTATE_INDET :
666 bFile ? TRISTATE_TRUE : TRISTATE_FALSE);
667
668 if (bConditionValid)
669 m_xConditionED->set_text(sCondition);
670 else
671 {
672 m_xConditionFT->set_sensitive(false);
673 m_xConditionED->set_sensitive(false);
674 }
675
676 m_xCurName->set_sensitive(false);
677 m_xDDECB->set_sensitive(false);
678 m_xDDEFrame->set_sensitive(false);
679 m_xOptionsPB->set_sensitive(false);
680 bool bPasswdEnabled = m_xProtectCB->get_state() == TRISTATE_TRUE;
681 m_xPasswdCB->set_sensitive(bPasswdEnabled);
682 m_xPasswdPB->set_sensitive(bPasswdEnabled);
683 if(!bPasswdValid)
684 {
685 rBox.get_selected(xIter.get());
686 rBox.unselect_all();
687 rBox.select(*xIter);
688 GetFirstEntryHdl(rBox);
689 return;
690 }
691 else
692 m_xPasswdCB->set_active(aCurPasswd.hasElements());
693 }
694 else if (bEntry )
695 {
696 m_xCurName->set_sensitive(true);
697 m_xOptionsPB->set_sensitive(true);
698 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
699 SwSectionData const& rData( pRepr->GetSectionData() );
700 m_xConditionED->set_text(rData.GetCondition());
701 m_xHideCB->set_sensitive(true);
702 m_xHideCB->set_state((rData.IsHidden()) ? TRISTATE_TRUE : TRISTATE_FALSE);
703 bool bHide = TRISTATE_TRUE == m_xHideCB->get_state();
704 m_xConditionED->set_sensitive(bHide);
705 m_xConditionFT->set_sensitive(bHide);
706 m_xPasswdCB->set_active(rData.GetPassword().hasElements());
707
708 m_xOK->set_sensitive(true);
709 m_xPasswdCB->set_sensitive(true);
710 m_xCurName->set_text(rBox.get_text(*xIter));
711 m_xCurName->set_sensitive(true);
712 m_xDismiss->set_sensitive(true);
713 const OUString aFile = pRepr->GetFile();
714 const OUString sSub = pRepr->GetSubRegion();
715 m_xSubRegionED->clear();
716 m_xSubRegionED->append_text(""); // put in a dummy entry, which is replaced when m_bSubRegionsFilled is set
717 m_bSubRegionsFilled = false;
718 if( !aFile.isEmpty() || !sSub.isEmpty() )
719 {
720 m_xFileCB->set_active(true);
721 m_xFileNameED->set_text(aFile);
722 m_xSubRegionED->set_entry_text(sSub);
723 m_xDDECB->set_active(rData.GetType() == SectionType::DdeLink);
724 }
725 else
726 {
727 m_xFileCB->set_active(false);
728 m_xFileNameED->set_text(aFile);
729 m_xDDECB->set_sensitive(false);
730 m_xDDECB->set_active(false);
731 }
732 UseFileHdl(*m_xFileCB);
733 DDEHdl(*m_xDDECB);
734 m_xProtectCB->set_state((rData.IsProtectFlag())
736 m_xProtectCB->set_sensitive(true);
737
738 // edit in readonly sections
739 m_xEditInReadonlyCB->set_state((rData.IsEditInReadonlyFlag())
741 m_xEditInReadonlyCB->set_sensitive(true);
742
743 bool bPasswdEnabled = m_xProtectCB->get_active();
744 m_xPasswdCB->set_sensitive(bPasswdEnabled);
745 m_xPasswdPB->set_sensitive(bPasswdEnabled);
746 }
747 m_bDontCheckPasswd = false;
748}
749
750// in OkHdl the modified settings are being applied and reversed regions are deleted
752{
753 // temp. Array because during changing of a region the position
754 // inside of the "Core-Arrays" can be shifted:
755 // - at linked regions, when they have more SubRegions or get
756 // new ones.
757 // StartUndo must certainly also happen not before the formats
758 // are copied (ClearRedo!)
759
760 const SwSectionFormats& rDocFormats = m_rSh.GetDoc()->GetSections();
761 SwSectionFormats aOrigArray(rDocFormats);
762
763 m_rSh.StartAllAction();
764 m_rSh.StartUndo();
765 m_rSh.ResetSelect( nullptr,false );
766
767 std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
768 if (m_xTree->get_iter_first(*xIter))
769 {
770 do
771 {
772 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
773 SwSectionFormat* pFormat = aOrigArray[ pRepr->GetArrPos() ];
774 if (!pRepr->GetSectionData().IsProtectFlag())
775 {
776 pRepr->GetSectionData().SetPassword(uno::Sequence<sal_Int8 >());
777 }
778 size_t nNewPos = rDocFormats.GetPos(pFormat);
779 if ( SIZE_MAX != nNewPos )
780 {
781 std::unique_ptr<SfxItemSet> pSet(pFormat->GetAttrSet().Clone( false ));
782 if( pFormat->GetCol() != pRepr->GetCol() )
783 pSet->Put( pRepr->GetCol() );
784
785 std::unique_ptr<SvxBrushItem> aBrush(pFormat->makeBackgroundBrushItem(false));
786 if( pRepr->GetBackground() && *aBrush != *pRepr->GetBackground() )
787 pSet->Put( *pRepr->GetBackground() );
788
789 if( pFormat->GetFootnoteAtTextEnd(false) != pRepr->GetFootnoteNtAtEnd() )
790 pSet->Put( pRepr->GetFootnoteNtAtEnd() );
791
792 if( pFormat->GetEndAtTextEnd(false) != pRepr->GetEndNtAtEnd() )
793 pSet->Put( pRepr->GetEndNtAtEnd() );
794
795 if( pFormat->GetBalancedColumns() != pRepr->GetBalance() )
796 pSet->Put( pRepr->GetBalance() );
797
798 if( pFormat->GetFrameDir() != *pRepr->GetFrameDir() )
799 pSet->Put( *pRepr->GetFrameDir() );
800
801 if( pFormat->GetLRSpace() != *pRepr->GetLRSpace())
802 pSet->Put( *pRepr->GetLRSpace());
803
804 m_rSh.UpdateSection( nNewPos, pRepr->GetSectionData(),
805 pSet->Count() ? pSet.get() : nullptr );
806 }
807 } while (m_xTree->iter_next(*xIter));
808 }
809
810 for (SectReprs_t::reverse_iterator it = m_SectReprs.rbegin(), aEnd = m_SectReprs.rend(); it != aEnd; ++it)
811 {
812 assert(it->first == it->second->GetArrPos());
813 SwSectionFormat* pFormat = aOrigArray[ it->second->GetArrPos() ];
814 const size_t nNewPos = rDocFormats.GetPos( pFormat );
815 if( SIZE_MAX != nNewPos )
816 m_rSh.DelSectionFormat( nNewPos );
817 }
818
819 aOrigArray.clear();
820
821 // response must be called ahead of EndAction's end,
822 // otherwise ScrollError can occur.
823 m_xDialog->response(RET_OK);
824
825 m_rSh.EndUndo();
826 m_rSh.EndAllAction();
827}
828
829// Toggle protect
830IMPL_LINK(SwEditRegionDlg, ChangeProtectHdl, weld::Toggleable&, rButton, void)
831{
832 if (!CheckPasswd(&rButton))
833 return;
834 bool bCheck = TRISTATE_TRUE == rButton.get_state();
835 m_xTree->selected_foreach([this, bCheck](weld::TreeIter& rEntry){
836 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
837 pRepr->GetSectionData().SetProtectFlag(bCheck);
838 OUString aImage = BuildBitmap(bCheck, TRISTATE_TRUE == m_xHideCB->get_state());
839 m_xTree->set_image(rEntry, aImage);
840 return false;
841 });
842 m_xPasswdCB->set_sensitive(bCheck);
843 m_xPasswdPB->set_sensitive(bCheck);
844}
845
846// Toggle hide
847IMPL_LINK( SwEditRegionDlg, ChangeHideHdl, weld::Toggleable&, rButton, void)
848{
849 if (!CheckPasswd(&rButton))
850 return;
851 m_xTree->selected_foreach([this, &rButton](weld::TreeIter& rEntry){
852 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
853 pRepr->GetSectionData().SetHidden(TRISTATE_TRUE == rButton.get_state());
854 OUString aImage = BuildBitmap(TRISTATE_TRUE == m_xProtectCB->get_state(),
855 TRISTATE_TRUE == rButton.get_state());
856 m_xTree->set_image(rEntry, aImage);
857 return false;
858 });
859 bool bHide = TRISTATE_TRUE == rButton.get_state();
860 m_xConditionED->set_sensitive(bHide);
861 m_xConditionFT->set_sensitive(bHide);
862}
863
864// Toggle edit in readonly
865IMPL_LINK(SwEditRegionDlg, ChangeEditInReadonlyHdl, weld::Toggleable&, rButton, void)
866{
867 if (!CheckPasswd(&rButton))
868 return;
869 m_xTree->selected_foreach([this, &rButton](weld::TreeIter& rEntry){
870 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
872 TRISTATE_TRUE == rButton.get_state());
873 return false;
874 });
875}
876
877// clear selected region
879{
880 if(!CheckPasswd())
881 return;
882 // at first mark all selected
883 m_xTree->selected_foreach([this](weld::TreeIter& rEntry){
884 SectRepr* const pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
885 pSectRepr->SetSelected();
886 return false;
887 });
888
889 std::unique_ptr<weld::TreeIter> xEntry(m_xTree->make_iterator());
890 bool bEntry(m_xTree->get_selected(xEntry.get()));
891 // then delete
892 while (bEntry)
893 {
894 SectRepr* const pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xEntry));
895 std::unique_ptr<weld::TreeIter> xRemove;
896 bool bRestart = false;
897 if (pSectRepr->IsSelected())
898 {
899 m_SectReprs.insert(std::make_pair(pSectRepr->GetArrPos(),
900 std::unique_ptr<SectRepr>(pSectRepr)));
901 if (m_xTree->iter_has_child(*xEntry))
902 {
903 std::unique_ptr<weld::TreeIter> xChild(m_xTree->make_iterator(xEntry.get()));
904 (void)m_xTree->iter_children(*xChild);
905 std::unique_ptr<weld::TreeIter> xParent(m_xTree->make_iterator(xEntry.get()));
906 if (!m_xTree->iter_parent(*xParent))
907 xParent.reset();
908 bool bChild = true;
909 do
910 {
911 // because of the repositioning we have to start at the beginning again
912 bRestart = true;
913 std::unique_ptr<weld::TreeIter> xMove(m_xTree->make_iterator(xChild.get()));
914 bChild = m_xTree->iter_next_sibling(*xChild);
915 m_xTree->move_subtree(*xMove, xParent.get(), m_xTree->get_iter_index_in_parent(*xEntry));
916 } while (bChild);
917 }
918 xRemove = m_xTree->make_iterator(xEntry.get());
919 }
920 if (bRestart)
921 bEntry = m_xTree->get_iter_first(*xEntry);
922 else
923 bEntry = m_xTree->iter_next(*xEntry);
924 if (xRemove)
925 m_xTree->remove(*xRemove);
926 }
927
928 if (m_xTree->get_selected(nullptr))
929 return;
930
931 m_xConditionFT->set_sensitive(false);
932 m_xConditionED->set_sensitive(false);
933 m_xDismiss->set_sensitive(false);
934 m_xCurName->set_sensitive(false);
935 m_xProtectCB->set_sensitive(false);
936 m_xPasswdCB->set_sensitive(false);
937 m_xHideCB->set_sensitive(false);
938 // edit in readonly sections
939 m_xEditInReadonlyCB->set_sensitive(false);
940 m_xEditInReadonlyCB->set_state(TRISTATE_FALSE);
941 m_xProtectCB->set_state(TRISTATE_FALSE);
942 m_xPasswdCB->set_active(false);
943 m_xHideCB->set_state(TRISTATE_FALSE);
944 m_xFileCB->set_active(false);
945 // otherwise the focus would be on HelpButton
946 m_xOK->grab_focus();
947 UseFileHdl(*m_xFileCB);
948}
949
950// link CheckBox to file?
951IMPL_LINK(SwEditRegionDlg, UseFileHdl, weld::Toggleable&, rButton, void)
952{
953 if (!CheckPasswd(&rButton))
954 return;
955 bool bMulti = 1 < m_xTree->count_selected_rows();
956 bool bFile = rButton.get_active();
957 if (m_xTree->get_selected(nullptr))
958 {
959 m_xTree->selected_foreach([&](weld::TreeIter& rEntry){
960 SectRepr* const pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
961 bool bContent = pSectRepr->IsContent();
962 if( rButton.get_active() && bContent && m_rSh.HasSelection() )
963 {
964 std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(m_xDialog.get(),
965 VclMessageType::Question, VclButtonsType::YesNo,
966 SwResId(STR_QUERY_CONNECT)));
967 if (RET_NO == xQueryBox->run())
968 rButton.set_active( false );
969 }
970 if( bFile )
971 pSectRepr->SetContent(false);
972 else
973 {
974 pSectRepr->SetFile(u"");
975 pSectRepr->SetSubRegion(std::u16string_view());
976 pSectRepr->GetSectionData().SetLinkFilePassword(OUString());
977 }
978 return false;
979 });
980 m_xDDECB->set_sensitive(bFile && !bMulti);
981 m_xDDEFrame->set_sensitive(bFile && !bMulti);
982 if( bFile )
983 {
984 m_xProtectCB->set_state(TRISTATE_TRUE);
985 m_xFileNameED->grab_focus();
986
987 }
988 else
989 {
990 m_xDDECB->set_active(false);
991 m_xSubRegionED->set_entry_text(OUString());
992 }
993 DDEHdl(*m_xDDECB);
994 }
995 else
996 {
997 rButton.set_active(false);
998 rButton.set_sensitive(false);
999 m_xDDECB->set_active(false);
1000 m_xDDECB->set_sensitive(false);
1001 m_xDDEFrame->set_sensitive(false);
1002 }
1003}
1004
1005// call dialog paste file
1007{
1008 if(!CheckPasswd())
1009 return;
1010 m_pDocInserter.reset(new ::sfx2::DocumentInserter(m_xDialog.get(), "swriter"));
1011 m_pDocInserter->StartExecuteModal( LINK( this, SwEditRegionDlg, DlgClosedHdl ) );
1012}
1013
1015{
1016 if(!CheckPasswd())
1017 return;
1018 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1019 if (!pSectRepr)
1020 return;
1021
1029 SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE> aSet( m_rSh.GetView().GetPool() );
1030
1031 aSet.Put( pSectRepr->GetCol() );
1032 aSet.Put( *pSectRepr->GetBackground() );
1033 aSet.Put( pSectRepr->GetFootnoteNtAtEnd() );
1034 aSet.Put( pSectRepr->GetEndNtAtEnd() );
1035 aSet.Put( pSectRepr->GetBalance() );
1036 aSet.Put( *pSectRepr->GetFrameDir() );
1037 aSet.Put( *pSectRepr->GetLRSpace() );
1038
1039 const SwSectionFormats& rDocFormats = m_rSh.GetDoc()->GetSections();
1040 SwSectionFormats aOrigArray(rDocFormats);
1041
1042 SwSectionFormat* pFormat = aOrigArray[pSectRepr->GetArrPos()];
1043 tools::Long nWidth = m_rSh.GetSectionWidth(*pFormat);
1044 aOrigArray.clear();
1045 if (!nWidth)
1046 nWidth = USHRT_MAX;
1047
1048 aSet.Put(SwFormatFrameSize(SwFrameSize::Variable, nWidth));
1049 aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
1050
1051 SwSectionPropertyTabDialog aTabDlg(m_xDialog.get(), aSet, m_rSh);
1052 if (RET_OK != aTabDlg.run())
1053 return;
1054
1055 const SfxItemSet* pOutSet = aTabDlg.GetOutputItemSet();
1056 if( !(pOutSet && pOutSet->Count()) )
1057 return;
1058
1059 const SwFormatCol* pColItem = pOutSet->GetItemIfSet(
1060 RES_COL, false );
1061 const SvxBrushItem* pBrushItem = pOutSet->GetItemIfSet(
1062 RES_BACKGROUND, false );
1063 const SwFormatFootnoteAtTextEnd* pFootnoteItem = pOutSet->GetItemIfSet(
1064 RES_FTN_AT_TXTEND, false );
1065 const SwFormatEndAtTextEnd* pEndItem = pOutSet->GetItemIfSet(
1066 RES_END_AT_TXTEND, false );
1067 const SwFormatNoBalancedColumns* pBalanceItem = pOutSet->GetItemIfSet(
1068 RES_COLUMNBALANCE, false );
1069 const SvxFrameDirectionItem* pFrameDirItem = pOutSet->GetItemIfSet(
1070 RES_FRAMEDIR, false );
1071 const SvxLRSpaceItem* pLRSpaceItem = pOutSet->GetItemIfSet(
1072 RES_LR_SPACE, false );
1073
1074 if( !(pColItem ||
1075 pBrushItem ||
1076 pFootnoteItem ||
1077 pEndItem ||
1078 pBalanceItem ||
1079 pFrameDirItem ||
1080 pLRSpaceItem) )
1081 return;
1082
1083 m_xTree->selected_foreach([&](weld::TreeIter& rEntry)
1084 {
1085 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
1086 if (pColItem)
1087 pRepr->GetCol() = *pColItem;
1088 if (pBrushItem)
1089 pRepr->GetBackground().reset(pBrushItem->Clone());
1090 if (pFootnoteItem)
1091 pRepr->GetFootnoteNtAtEnd() = *pFootnoteItem;
1092 if (pEndItem)
1093 pRepr->GetEndNtAtEnd() = *pEndItem;
1094 if (pBalanceItem)
1095 pRepr->GetBalance().SetValue(pBalanceItem->GetValue());
1096 if (pFrameDirItem)
1097 pRepr->GetFrameDir()->SetValue(pFrameDirItem->GetValue());
1098 if (pLRSpaceItem)
1099 pRepr->GetLRSpace().reset(pLRSpaceItem->Clone());
1100 return false;
1101 });
1102}
1103
1104IMPL_LINK(SwEditRegionDlg, FileNameComboBoxHdl, weld::ComboBox&, rEdit, void)
1105{
1106 int nStartPos, nEndPos;
1107 rEdit.get_entry_selection_bounds(nStartPos, nEndPos);
1108 if (!CheckPasswd())
1109 return;
1110 rEdit.select_entry_region(nStartPos, nEndPos);
1111 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1112 pSectRepr->SetSubRegion( rEdit.get_active_text() );
1113}
1114
1115// Applying of the filename or the linked region
1116IMPL_LINK(SwEditRegionDlg, FileNameEntryHdl, weld::Entry&, rEdit, void)
1117{
1118 int nStartPos, nEndPos;
1119 rEdit.get_selection_bounds(nStartPos, nEndPos);
1120 if (!CheckPasswd())
1121 return;
1122 rEdit.select_region(nStartPos, nEndPos);
1123 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1124 m_xSubRegionED->clear();
1125 m_xSubRegionED->append_text(""); // put in a dummy entry, which is replaced when m_bSubRegionsFilled is set
1126 m_bSubRegionsFilled = false;
1127 if (m_xDDECB->get_active())
1128 {
1129 OUString sLink( CollapseWhiteSpaces(rEdit.get_text()) );
1130 sal_Int32 nPos = 0;
1131 sLink = sLink.replaceFirst( " ", OUStringChar(sfx2::cTokenSeparator), &nPos );
1132 if (nPos>=0)
1133 {
1134 sLink = sLink.replaceFirst( " ", OUStringChar(sfx2::cTokenSeparator), &nPos );
1135 }
1136
1137 pSectRepr->GetSectionData().SetLinkFileName( sLink );
1139 }
1140 else
1141 {
1142 OUString sTmp(rEdit.get_text());
1143 if(!sTmp.isEmpty())
1144 {
1145 SfxMedium* pMedium = m_rSh.GetView().GetDocShell()->GetMedium();
1146 INetURLObject aAbs;
1147 if( pMedium )
1148 aAbs = pMedium->GetURLObject();
1150 aAbs, sTmp, URIHelper::GetMaybeFileHdl() );
1151 }
1152 pSectRepr->SetFile( sTmp );
1153 pSectRepr->GetSectionData().SetLinkFilePassword(OUString());
1154 }
1155}
1156
1158{
1159 if (!CheckPasswd(&rButton))
1160 return;
1161 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1162 if (!pSectRepr)
1163 return;
1164
1165 bool bFile = m_xFileCB->get_active();
1166 SwSectionData & rData( pSectRepr->GetSectionData() );
1167 bool bDDE = rButton.get_active();
1168 if(bDDE)
1169 {
1170 m_xFileNameFT->hide();
1171 m_xDDECommandFT->set_sensitive(true);
1172 m_xDDECommandFT->show();
1173 m_xSubRegionFT->hide();
1174 m_xSubRegionED->hide();
1175 if (SectionType::FileLink == rData.GetType())
1176 {
1177 pSectRepr->SetFile(u"");
1178 m_xFileNameED->set_text(OUString());
1179 rData.SetLinkFilePassword(OUString());
1180 }
1182 }
1183 else
1184 {
1185 m_xDDECommandFT->hide();
1186 m_xFileNameFT->set_sensitive(bFile);
1188 m_xFileNameFT->show();
1189 m_xSubRegionED->show();
1190 m_xSubRegionFT->show();
1191 m_xSubRegionED->set_sensitive(bFile);
1192 m_xSubRegionFT->set_sensitive(bFile);
1193 m_xSubRegionED->set_sensitive(bFile);
1194 if (SectionType::DdeLink == rData.GetType())
1195 {
1197 pSectRepr->SetFile(u"");
1198 rData.SetLinkFilePassword(OUString());
1199 m_xFileNameED->set_text(OUString());
1200 }
1201 }
1202 m_xFilePB->set_sensitive(bFile && !bDDE);
1203}
1204
1206{
1207 if (!CheckPasswd())
1208 {
1209 if (!bChange)
1210 m_xPasswdCB->set_active(!m_xPasswdCB->get_active());
1211 return;
1212 }
1213
1214 bool bSet = bChange ? bChange : m_xPasswdCB->get_active();
1215
1216 m_xTree->selected_foreach([this, bChange, bSet](weld::TreeIter& rEntry){
1217 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
1218 if(bSet)
1219 {
1220 if(!pRepr->GetTempPasswd().hasElements() || bChange)
1221 {
1222 SfxPasswordDialog aPasswdDlg(m_xDialog.get());
1223 aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM);
1224 if (RET_OK == aPasswdDlg.run())
1225 {
1226 const OUString sNewPasswd(aPasswdDlg.GetPassword());
1227 if (aPasswdDlg.GetConfirm() == sNewPasswd)
1228 {
1229 SvPasswordHelper::GetHashPassword( pRepr->GetTempPasswd(), sNewPasswd );
1230 }
1231 else
1232 {
1233 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
1234 VclMessageType::Info, VclButtonsType::Ok,
1235 SwResId(STR_WRONG_PASSWD_REPEAT)));
1236 xInfoBox->run();
1237 ChangePasswd(bChange);
1238 return true;
1239 }
1240 }
1241 else
1242 {
1243 if(!bChange)
1244 m_xPasswdCB->set_active(false);
1245 return true;
1246 }
1247 }
1248 pRepr->GetSectionData().SetPassword(pRepr->GetTempPasswd());
1249 }
1250 else
1251 {
1252 pRepr->GetSectionData().SetPassword(uno::Sequence<sal_Int8 >());
1253 }
1254 return false;
1255 });
1256}
1257
1259{
1260 ChangePasswd(false);
1261}
1262
1264{
1265 ChangePasswd(true);
1266}
1267
1268// the current region name is being added to the TreeListBox immediately during
1269// editing, with empty string no Ok()
1271{
1272 if(!CheckPasswd())
1273 return;
1274 std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
1275 if (m_xTree->get_selected(xIter.get()))
1276 {
1277 const OUString aName = m_xCurName->get_text();
1278 m_xTree->set_text(*xIter, aName);
1279 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
1281
1282 m_xOK->set_sensitive(!aName.isEmpty());
1283 }
1284}
1285
1286IMPL_LINK( SwEditRegionDlg, ConditionEditHdl, weld::Entry&, rEdit, void )
1287{
1288 int nStartPos, nEndPos;
1289 rEdit.get_selection_bounds(nStartPos, nEndPos);
1290 if(!CheckPasswd())
1291 return;
1292 rEdit.select_region(nStartPos, nEndPos);
1293
1294 m_xTree->selected_foreach([this, &rEdit](weld::TreeIter& rEntry){
1295 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
1296 pRepr->GetSectionData().SetCondition(rEdit.get_text());
1297 return false;
1298 });
1299}
1300
1301IMPL_LINK( SwEditRegionDlg, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg, void )
1302{
1303 OUString sFileName, sFilterName, sPassword;
1304 if ( _pFileDlg->GetError() == ERRCODE_NONE )
1305 {
1306 std::unique_ptr<SfxMedium> pMedium(m_pDocInserter->CreateMedium("sglobal"));
1307 if ( pMedium )
1308 {
1309 sFileName = pMedium->GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE );
1310 sFilterName = pMedium->GetFilter()->GetFilterName();
1311 if ( const SfxStringItem* pItem = pMedium->GetItemSet().GetItemIfSet( SID_PASSWORD, false ) )
1312 sPassword = pItem->GetValue();
1313 ::lcl_ReadSections(*pMedium, *m_xSubRegionED);
1314 }
1315 }
1316
1317 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1318 if (pSectRepr)
1319 {
1320 pSectRepr->SetFile( sFileName );
1321 pSectRepr->SetFilter( sFilterName );
1322 pSectRepr->GetSectionData().SetLinkFilePassword(sPassword);
1323 m_xFileNameED->set_text(pSectRepr->GetFile());
1324 }
1325}
1326
1328{
1329 if (m_bSubRegionsFilled)
1330 return;
1331
1332 //if necessary fill the names bookmarks/sections/tables now
1333
1334 OUString sFileName = m_xFileNameED->get_text();
1335 if(!sFileName.isEmpty())
1336 {
1337 SfxMedium* pMedium = m_rSh.GetView().GetDocShell()->GetMedium();
1338 INetURLObject aAbs;
1339 if( pMedium )
1340 aAbs = pMedium->GetURLObject();
1341 sFileName = URIHelper::SmartRel2Abs(
1342 aAbs, sFileName, URIHelper::GetMaybeFileHdl() );
1343
1344 //load file and set the shell
1345 SfxMedium aMedium( sFileName, StreamMode::STD_READ );
1347 ::lcl_ReadSections(aMedium, *m_xSubRegionED);
1348 }
1349 else
1350 lcl_FillSubRegionList(m_rSh, *m_xSubRegionED, nullptr);
1351 m_bSubRegionsFilled = true;
1352}
1353
1354// helper function - read section names from medium
1355static void lcl_ReadSections( SfxMedium& rMedium, weld::ComboBox& rBox )
1356{
1357 rBox.clear();
1358 uno::Reference < embed::XStorage > xStg;
1359 if( !(rMedium.IsStorage() && (xStg = rMedium.GetStorage()).is()) )
1360 return;
1361
1362 std::vector<OUString> aArr;
1364 if ( nFormat == SotClipboardFormatId::STARWRITER_60 || nFormat == SotClipboardFormatId::STARWRITERGLOB_60 ||
1365 nFormat == SotClipboardFormatId::STARWRITER_8 || nFormat == SotClipboardFormatId::STARWRITERGLOB_8)
1366 SwGetReaderXML()->GetSectionList( rMedium, aArr );
1367
1368 for (auto const& it : aArr)
1369 {
1370 rBox.append_text(it);
1371 }
1372}
1373
1375 weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh)
1376 : SfxTabDialogController(pParent, "modules/swriter/ui/insertsectiondialog.ui",
1377 "InsertSectionDialog",&rSet)
1378 , m_rWrtSh(rSh)
1379{
1381 AddTabPage("section", SwInsertSectionTabPage::Create, nullptr);
1382 AddTabPage("columns", SwColumnPage::Create, nullptr);
1383 AddTabPage("background", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_BKG), nullptr);
1385 AddTabPage("indents", SwSectionIndentTabPage::Create, nullptr);
1386
1388
1389 bool bWeb = dynamic_cast<SwWebDocShell*>( rSh.GetView().GetDocShell() ) != nullptr ;
1390 if(bWeb)
1391 {
1392 RemoveTabPage("notes");
1393 RemoveTabPage("indents");
1394 if( HTML_CFG_NS40 != nHtmlMode && HTML_CFG_WRITER != nHtmlMode)
1395 RemoveTabPage("columns");
1396 }
1397 SetCurPageId("section");
1398}
1399
1401{
1402}
1403
1404void SwInsertSectionTabDialog::PageCreated(const OUString& rId, SfxTabPage &rPage)
1405{
1406 if (rId == "section")
1407 static_cast<SwInsertSectionTabPage&>(rPage).SetWrtShell(m_rWrtSh);
1408 else if (rId == "background")
1409 {
1410 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
1411 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_SELECTOR)));
1412 rPage.PageCreated(aSet);
1413 }
1414 else if (rId == "columns")
1415 {
1417 static_cast<SwColumnPage&>(rPage).SetPageWidth(rSize.GetWidth());
1418 static_cast<SwColumnPage&>(rPage).ShowBalance(true);
1419 static_cast<SwColumnPage&>(rPage).SetInSection(true);
1420 }
1421 else if (rId == "indents")
1422 static_cast<SwSectionIndentTabPage&>(rPage).SetWrtShell(m_rWrtSh);
1423}
1424
1426{
1427 m_pSectionData.reset( new SwSectionData(rSect) );
1428}
1429
1431{
1432 short nRet = SfxTabDialogController::Ok();
1433 OSL_ENSURE(m_pSectionData, "SwInsertSectionTabDialog: no SectionData?");
1434 const SfxItemSet* pOutputItemSet = GetOutputItemSet();
1435 m_rWrtSh.InsertSection(*m_pSectionData, pOutputItemSet);
1436 SfxViewFrame& rViewFrame = m_rWrtSh.GetView().GetViewFrame();
1437 uno::Reference< frame::XDispatchRecorder > xRecorder =
1438 rViewFrame.GetBindings().GetRecorder();
1439 if ( xRecorder.is() )
1440 {
1441 SfxRequest aRequest(rViewFrame, FN_INSERT_REGION);
1442 if(const SwFormatCol* pCol = pOutputItemSet->GetItemIfSet(RES_COL, false))
1443 {
1444 aRequest.AppendItem(SfxUInt16Item(SID_ATTR_COLUMNS,
1445 pCol->GetColumns().size()));
1446 }
1448 m_pSectionData->GetSectionName()));
1450 m_pSectionData->GetCondition()));
1452 m_pSectionData->IsHidden()));
1454 m_pSectionData->IsProtectFlag()));
1455 // edit in readonly sections
1457 m_pSectionData->IsEditInReadonlyFlag()));
1458
1459 const OUString sLinkFileName( m_pSectionData->GetLinkFileName() );
1460 sal_Int32 n = 0;
1461 aRequest.AppendItem(SfxStringItem( FN_PARAM_1, sLinkFileName.getToken( 0, sfx2::cTokenSeparator, n )));
1462 aRequest.AppendItem(SfxStringItem( FN_PARAM_2, sLinkFileName.getToken( 0, sfx2::cTokenSeparator, n )));
1463 aRequest.AppendItem(SfxStringItem( FN_PARAM_3, sLinkFileName.getToken( 0, sfx2::cTokenSeparator, n )));
1464 aRequest.Done();
1465 }
1466 return nRet;
1467}
1468
1470 : SfxTabPage(pPage, pController, "modules/swriter/ui/sectionpage.ui", "SectionPage", &rAttrSet)
1471 , m_pWrtSh(nullptr)
1472 , m_xCurName(m_xBuilder->weld_entry_tree_view("sectionnames", "sectionnames-entry",
1473 "sectionnames-list"))
1474 , m_xFileCB(m_xBuilder->weld_check_button("link"))
1475 , m_xDDECB(m_xBuilder->weld_check_button("dde"))
1476 , m_xDDECommandFT(m_xBuilder->weld_label("ddelabel"))
1477 , m_xFileNameFT(m_xBuilder->weld_label("filelabel"))
1478 , m_xFileNameED(m_xBuilder->weld_entry("filename"))
1479 , m_xFilePB(m_xBuilder->weld_button("selectfile"))
1480 , m_xSubRegionFT(m_xBuilder->weld_label("sectionlabel"))
1481 , m_xSubRegionED(m_xBuilder->weld_combo_box("sectionname"))
1482 , m_xProtectCB(m_xBuilder->weld_check_button("protect"))
1483 , m_xPasswdCB(m_xBuilder->weld_check_button("withpassword"))
1484 , m_xPasswdPB(m_xBuilder->weld_button("selectpassword"))
1485 , m_xHideCB(m_xBuilder->weld_check_button("hide"))
1486 , m_xConditionFT(m_xBuilder->weld_label("condlabel"))
1487 , m_xConditionED(new ConditionEdit(m_xBuilder->weld_entry("withcond")))
1488 // edit in readonly sections
1489 , m_xEditInReadonlyCB(m_xBuilder->weld_check_button("editable"))
1490{
1491 m_xCurName->make_sorted();
1492 m_xCurName->set_height_request_by_rows(12);
1493 m_xSubRegionED->make_sorted();
1494
1495 m_xProtectCB->connect_toggled( LINK( this, SwInsertSectionTabPage, ChangeProtectHdl));
1496 m_xPasswdCB->connect_toggled( LINK( this, SwInsertSectionTabPage, TogglePasswdHdl));
1497 m_xPasswdPB->connect_clicked( LINK( this, SwInsertSectionTabPage, ChangePasswdHdl));
1498 m_xHideCB->connect_toggled( LINK( this, SwInsertSectionTabPage, ChangeHideHdl));
1499 m_xFileCB->connect_toggled( LINK( this, SwInsertSectionTabPage, UseFileHdl ));
1500 m_xFilePB->connect_clicked( LINK( this, SwInsertSectionTabPage, FileSearchHdl ));
1501 m_xCurName->connect_changed( LINK( this, SwInsertSectionTabPage, NameEditHdl));
1502 m_xDDECB->connect_toggled( LINK( this, SwInsertSectionTabPage, DDEHdl ));
1503 ChangeProtectHdl(*m_xProtectCB);
1504 m_xSubRegionED->set_entry_completion(true, true);
1505
1506 // Hide Link section. In general it makes no sense to insert a file from the jail,
1507 // because it does not contain any usable files (documents).
1509 {
1510 m_xBuilder->weld_label("label1")->hide(); // Link
1511 m_xFileCB->hide();
1512 m_xDDECB->hide();
1513 m_xDDECommandFT->hide();
1514 m_xFileNameFT->hide();
1515 m_xFileNameED->hide();
1516 m_xFilePB->hide();
1517 m_xSubRegionFT->hide();
1518 m_xSubRegionED->hide();
1519 }
1520}
1521
1523{
1524}
1525
1527{
1528 m_pWrtSh = &rSh;
1529
1530 bool bWeb = dynamic_cast<SwWebDocShell*>( m_pWrtSh->GetView().GetDocShell() )!= nullptr;
1531 if(bWeb)
1532 {
1533 m_xHideCB->hide();
1534 m_xConditionED->hide();
1535 m_xConditionFT->hide();
1536 m_xDDECB->hide();
1537 m_xDDECommandFT->hide();
1538 }
1539
1541
1542 SwSectionData *const pSectionData =
1544 ->GetSectionData();
1545 if (pSectionData) // something set?
1546 {
1547 const OUString sSectionName(pSectionData->GetSectionName());
1548 m_xCurName->set_entry_text(rSh.GetUniqueSectionName(&sSectionName));
1549 m_xProtectCB->set_active( pSectionData->IsProtectFlag() );
1550 ChangeProtectHdl(*m_xProtectCB);
1551 m_sFileName = pSectionData->GetLinkFileName();
1552 m_sFilePasswd = pSectionData->GetLinkFilePassword();
1553 m_xFileCB->set_active( !m_sFileName.isEmpty() );
1554 m_xFileNameED->set_text( m_sFileName );
1555 UseFileHdl(*m_xFileCB);
1556 }
1557 else
1558 {
1559 m_xCurName->set_entry_text(rSh.GetUniqueSectionName());
1560 }
1561}
1562
1564{
1565 SwSectionData aSection(SectionType::Content, m_xCurName->get_active_text());
1566 aSection.SetCondition(m_xConditionED->get_text());
1567 bool bProtected = m_xProtectCB->get_active();
1568 aSection.SetProtectFlag(bProtected);
1569 aSection.SetHidden(m_xHideCB->get_active());
1570 // edit in readonly sections
1571 aSection.SetEditInReadonlyFlag(m_xEditInReadonlyCB->get_active());
1572
1573 if(bProtected)
1574 {
1575 aSection.SetPassword(m_aNewPasswd);
1576 }
1577 const OUString sFileName = m_xFileNameED->get_text();
1578 const OUString sSubRegion = m_xSubRegionED->get_active_text();
1579 bool bDDe = m_xDDECB->get_active();
1580 if (m_xFileCB->get_active() && (!sFileName.isEmpty() || !sSubRegion.isEmpty() || bDDe))
1581 {
1582 OUString aLinkFile;
1583 if( bDDe )
1584 {
1585 aLinkFile = CollapseWhiteSpaces(sFileName);
1586 sal_Int32 nPos = 0;
1587 aLinkFile = aLinkFile.replaceFirst( " ", OUStringChar(sfx2::cTokenSeparator), &nPos );
1588 if (nPos>=0)
1589 {
1590 aLinkFile = aLinkFile.replaceFirst( " ", OUStringChar(sfx2::cTokenSeparator), &nPos );
1591 }
1592 }
1593 else
1594 {
1595 if(!sFileName.isEmpty())
1596 {
1597 SfxMedium* pMedium = m_pWrtSh->GetView().GetDocShell()->GetMedium();
1598 INetURLObject aAbs;
1599 if( pMedium )
1600 aAbs = pMedium->GetURLObject();
1601 aLinkFile = URIHelper::SmartRel2Abs(
1602 aAbs, sFileName, URIHelper::GetMaybeFileHdl() );
1604 }
1605
1606 aLinkFile += OUStringChar(sfx2::cTokenSeparator) + m_sFilterName
1607 + OUStringChar(sfx2::cTokenSeparator) + sSubRegion;
1608 }
1609
1610 aSection.SetLinkFileName(aLinkFile);
1611 if (!aLinkFile.isEmpty())
1612 {
1613 aSection.SetType( m_xDDECB->get_active() ?
1616 }
1617 }
1618 static_cast<SwInsertSectionTabDialog*>(GetDialogController())->SetSectionData(aSection);
1619 return true;
1620}
1621
1623{
1624}
1625
1626std::unique_ptr<SfxTabPage> SwInsertSectionTabPage::Create(weld::Container* pPage, weld::DialogController* pController,
1627 const SfxItemSet* rAttrSet)
1628{
1629 return std::make_unique<SwInsertSectionTabPage>(pPage, pController, *rAttrSet);
1630}
1631
1633{
1634 bool bHide = rBox.get_active();
1635 m_xConditionED->set_sensitive(bHide);
1636 m_xConditionFT->set_sensitive(bHide);
1637}
1638
1639IMPL_LINK(SwInsertSectionTabPage, ChangeProtectHdl, weld::Toggleable&, rBox, void)
1640{
1641 bool bCheck = rBox.get_active();
1642 m_xPasswdCB->set_sensitive(bCheck);
1643 m_xPasswdPB->set_sensitive(bCheck);
1644}
1645
1647{
1648 bool bSet = bChange ? bChange : m_xPasswdCB->get_active();
1649 if (bSet)
1650 {
1651 if(!m_aNewPasswd.hasElements() || bChange)
1652 {
1653 SfxPasswordDialog aPasswdDlg(GetFrameWeld());
1654 aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM);
1655 if (RET_OK == aPasswdDlg.run())
1656 {
1657 const OUString sNewPasswd(aPasswdDlg.GetPassword());
1658 if (aPasswdDlg.GetConfirm() == sNewPasswd)
1659 {
1661 }
1662 else
1663 {
1664 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
1665 VclMessageType::Info, VclButtonsType::Ok,
1666 SwResId(STR_WRONG_PASSWD_REPEAT)));
1667 xInfoBox->run();
1668 }
1669 }
1670 else if(!bChange)
1671 m_xPasswdCB->set_active(false);
1672 }
1673 }
1674 else
1675 m_aNewPasswd.realloc(0);
1676}
1677
1679{
1680 ChangePasswd(false);
1681}
1682
1684{
1685 ChangePasswd(true);
1686}
1687
1688
1690{
1691 const OUString aName = m_xCurName->get_active_text();
1692 GetDialogController()->GetOKButton().set_sensitive(!aName.isEmpty() &&
1693 m_xCurName->find_text(aName) == -1);
1694}
1695
1697{
1698 if (rButton.get_active())
1699 {
1700 if (m_pWrtSh->HasSelection())
1701 {
1702 std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
1703 VclMessageType::Question, VclButtonsType::YesNo,
1704 SwResId(STR_QUERY_CONNECT)));
1705 if (RET_NO == xQueryBox->run())
1706 rButton.set_active(false);
1707 }
1708 }
1709
1710 bool bFile = rButton.get_active();
1711 m_xFileNameFT->set_sensitive(bFile);
1712 m_xFileNameED->set_sensitive(bFile);
1713 m_xFilePB->set_sensitive(bFile);
1714 m_xSubRegionFT->set_sensitive(bFile);
1715 m_xSubRegionED->set_sensitive(bFile);
1716 m_xDDECommandFT->set_sensitive(bFile);
1717 m_xDDECB->set_sensitive(bFile);
1718 if (bFile)
1719 {
1720 m_xFileNameED->grab_focus();
1721 m_xProtectCB->set_active(true);
1722 ChangeProtectHdl(*m_xProtectCB);
1723 }
1724 else
1725 {
1726 m_xDDECB->set_active(false);
1727 DDEHdl(*m_xDDECB);
1728 }
1729}
1730
1732{
1733 m_pDocInserter.reset(new ::sfx2::DocumentInserter(GetFrameWeld(), "swriter"));
1734 m_pDocInserter->StartExecuteModal( LINK( this, SwInsertSectionTabPage, DlgClosedHdl ) );
1735}
1736
1738{
1739 bool bDDE = rButton.get_active();
1740 bool bFile = m_xFileCB->get_active();
1741 m_xFilePB->set_sensitive(!bDDE && bFile);
1742 if (bDDE)
1743 {
1744 m_xFileNameFT->hide();
1745 m_xDDECommandFT->set_sensitive(bDDE);
1746 m_xDDECommandFT->show();
1747 m_xSubRegionFT->hide();
1748 m_xSubRegionED->hide();
1749 m_xFileNameED->set_accessible_name(m_xDDECommandFT->get_label());
1750 }
1751 else
1752 {
1753 m_xDDECommandFT->hide();
1754 m_xFileNameFT->set_sensitive(bFile);
1756 m_xFileNameFT->show();
1757 m_xSubRegionFT->show();
1758 m_xSubRegionED->show();
1759 m_xSubRegionED->set_sensitive(bFile);
1760 m_xFileNameED->set_accessible_name(m_xFileNameFT->get_label());
1761 }
1762}
1763
1764IMPL_LINK( SwInsertSectionTabPage, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg, void )
1765{
1766 if ( _pFileDlg->GetError() == ERRCODE_NONE )
1767 {
1768 std::unique_ptr<SfxMedium> pMedium(m_pDocInserter->CreateMedium("sglobal"));
1769 if ( pMedium )
1770 {
1771 m_sFileName = pMedium->GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE );
1772 m_sFilterName = pMedium->GetFilter()->GetFilterName();
1773 if ( const SfxStringItem* pItem = pMedium->GetItemSet().GetItemIfSet( SID_PASSWORD, false ) )
1774 m_sFilePasswd = pItem->GetValue();
1775 m_xFileNameED->set_text( INetURLObject::decode(
1777 ::lcl_ReadSections(*pMedium, *m_xSubRegionED);
1778 }
1779 }
1780 else
1781 {
1782 m_sFilterName.clear();
1783 m_sFilePasswd.clear();
1784 }
1785}
1786
1788 : SfxTabPage(pPage, pController, "modules/swriter/ui/footnotesendnotestabpage.ui", "FootnotesEndnotesTabPage", &rAttrSet)
1789 , m_xFootnoteNtAtTextEndCB(m_xBuilder->weld_check_button("ftnntattextend"))
1790 , m_xFootnoteNtNumCB(m_xBuilder->weld_check_button("ftnntnum"))
1791 , m_xFootnoteOffsetLbl(m_xBuilder->weld_label("ftnoffset_label"))
1792 , m_xFootnoteOffsetField(m_xBuilder->weld_spin_button("ftnoffset"))
1793 , m_xFootnoteNtNumFormatCB(m_xBuilder->weld_check_button("ftnntnumfmt"))
1794 , m_xFootnotePrefixFT(m_xBuilder->weld_label("ftnprefix_label"))
1795 , m_xFootnotePrefixED(m_xBuilder->weld_entry("ftnprefix"))
1796 , m_xFootnoteNumViewBox(new SwNumberingTypeListBox(m_xBuilder->weld_combo_box("ftnnumviewbox")))
1797 , m_xFootnoteSuffixFT(m_xBuilder->weld_label("ftnsuffix_label"))
1798 , m_xFootnoteSuffixED(m_xBuilder->weld_entry("ftnsuffix"))
1799 , m_xEndNtAtTextEndCB(m_xBuilder->weld_check_button("endntattextend"))
1800 , m_xEndNtNumCB(m_xBuilder->weld_check_button("endntnum"))
1801 , m_xEndOffsetLbl(m_xBuilder->weld_label("endoffset_label"))
1802 , m_xEndOffsetField(m_xBuilder->weld_spin_button("endoffset"))
1803 , m_xEndNtNumFormatCB(m_xBuilder->weld_check_button("endntnumfmt"))
1804 , m_xEndPrefixFT(m_xBuilder->weld_label("endprefix_label"))
1805 , m_xEndPrefixED(m_xBuilder->weld_entry("endprefix"))
1806 , m_xEndNumViewBox(new SwNumberingTypeListBox(m_xBuilder->weld_combo_box("endnumviewbox")))
1807 , m_xEndSuffixFT(m_xBuilder->weld_label("endsuffix_label"))
1808 , m_xEndSuffixED(m_xBuilder->weld_entry("endsuffix"))
1809{
1812
1814 m_xFootnoteNtAtTextEndCB->connect_toggled( aLk );
1815 m_xFootnoteNtNumCB->connect_toggled( aLk );
1816 m_xEndNtAtTextEndCB->connect_toggled( aLk );
1817 m_xEndNtNumCB->connect_toggled( aLk );
1818 m_xFootnoteNtNumFormatCB->connect_toggled( aLk );
1819 m_xEndNtNumFormatCB->connect_toggled( aLk );
1820}
1821
1823{
1824}
1825
1827{
1829 ? ( m_xFootnoteNtNumCB->get_active()
1830 ? ( m_xFootnoteNtNumFormatCB->get_active()
1833 : FTNEND_ATTXTEND )
1835
1836 switch( aFootnote.GetValue() )
1837 {
1839 aFootnote.SetNumType( m_xFootnoteNumViewBox->GetSelectedNumberingType() );
1840 aFootnote.SetPrefix( m_xFootnotePrefixED->get_text().replaceAll("\\t", "\t") ); // fdo#65666
1841 aFootnote.SetSuffix( m_xFootnoteSuffixED->get_text().replaceAll("\\t", "\t") );
1842 [[fallthrough]];
1843
1845 aFootnote.SetOffset( static_cast< sal_uInt16 >( m_xFootnoteOffsetField->get_value()-1 ) );
1846 break;
1847 default: break;
1848 }
1849
1850 SwFormatEndAtTextEnd aEnd( m_xEndNtAtTextEndCB->get_active()
1851 ? ( m_xEndNtNumCB->get_active()
1852 ? ( m_xEndNtNumFormatCB->get_active()
1855 : FTNEND_ATTXTEND )
1857
1858 switch( aEnd.GetValue() )
1859 {
1861 aEnd.SetNumType( m_xEndNumViewBox->GetSelectedNumberingType() );
1862 aEnd.SetPrefix( m_xEndPrefixED->get_text().replaceAll("\\t", "\t") );
1863 aEnd.SetSuffix( m_xEndSuffixED->get_text().replaceAll("\\t", "\t") );
1864 [[fallthrough]];
1865
1867 aEnd.SetOffset( static_cast< sal_uInt16 >( m_xEndOffsetField->get_value()-1 ) );
1868 break;
1869 default: break;
1870 }
1871
1872 rSet->Put( aFootnote );
1873 rSet->Put( aEnd );
1874
1875 return true;
1876}
1877
1879 const SwFormatFootnoteEndAtTextEnd& rAttr )
1880{
1881 weld::CheckButton *pNtAtTextEndCB, *pNtNumCB, *pNtNumFormatCB;
1882 weld::Label *pPrefixFT, *pSuffixFT;
1883 weld::Entry *pPrefixED, *pSuffixED;
1884 SwNumberingTypeListBox *pNumViewBox;
1885 weld::Label *pOffsetText;
1886 weld::SpinButton *pOffsetField;
1887
1888 if( bFootnote )
1889 {
1890 pNtAtTextEndCB = m_xFootnoteNtAtTextEndCB.get();
1891 pNtNumCB = m_xFootnoteNtNumCB.get();
1892 pNtNumFormatCB = m_xFootnoteNtNumFormatCB.get();
1893 pPrefixFT = m_xFootnotePrefixFT.get();
1894 pPrefixED = m_xFootnotePrefixED.get();
1895 pSuffixFT = m_xFootnoteSuffixFT.get();
1896 pSuffixED = m_xFootnoteSuffixED.get();
1897 pNumViewBox = m_xFootnoteNumViewBox.get();
1898 pOffsetText = m_xFootnoteOffsetLbl.get();
1899 pOffsetField = m_xFootnoteOffsetField.get();
1900 }
1901 else
1902 {
1903 pNtAtTextEndCB = m_xEndNtAtTextEndCB.get();
1904 pNtNumCB = m_xEndNtNumCB.get();
1905 pNtNumFormatCB = m_xEndNtNumFormatCB.get();
1906 pPrefixFT = m_xEndPrefixFT.get();
1907 pPrefixED = m_xEndPrefixED.get();
1908 pSuffixFT = m_xEndSuffixFT.get();
1909 pSuffixED = m_xEndSuffixED.get();
1910 pNumViewBox = m_xEndNumViewBox.get();
1911 pOffsetText = m_xEndOffsetLbl.get();
1912 pOffsetField = m_xEndOffsetField.get();
1913 }
1914
1915 const sal_uInt16 eState = rAttr.GetValue();
1916 switch( eState )
1917 {
1919 pNtNumFormatCB->set_state( TRISTATE_TRUE );
1920 [[fallthrough]];
1921
1923 pNtNumCB->set_state( TRISTATE_TRUE );
1924 [[fallthrough]];
1925
1926 case FTNEND_ATTXTEND:
1927 pNtAtTextEndCB->set_state( TRISTATE_TRUE );
1928 // no break;
1929 }
1930
1931 pNumViewBox->SelectNumberingType( rAttr.GetNumType() );
1932 pOffsetField->set_value( rAttr.GetOffset() + 1 );
1933 pPrefixED->set_text( rAttr.GetPrefix().replaceAll("\t", "\\t") );
1934 pSuffixED->set_text( rAttr.GetSuffix().replaceAll("\t", "\\t") );
1935
1936 switch( eState )
1937 {
1939 pNtNumCB->set_sensitive( false );
1940 [[fallthrough]];
1941
1942 case FTNEND_ATTXTEND:
1943 pNtNumFormatCB->set_sensitive( false );
1944 pOffsetField->set_sensitive( false );
1945 pOffsetText->set_sensitive( false );
1946 [[fallthrough]];
1947
1949 pNumViewBox->set_sensitive( false );
1950 pPrefixFT->set_sensitive( false );
1951 pPrefixED->set_sensitive( false );
1952 pSuffixFT->set_sensitive( false );
1953 pSuffixED->set_sensitive( false );
1954 // no break;
1955 }
1956}
1957
1959{
1960 ResetState( true, rSet->Get( RES_FTN_AT_TXTEND, false ));
1961 ResetState( false, rSet->Get( RES_END_AT_TXTEND, false ));
1962}
1963
1964std::unique_ptr<SfxTabPage> SwSectionFootnoteEndTabPage::Create( weld::Container* pPage, weld::DialogController* pController,
1965 const SfxItemSet* rAttrSet)
1966{
1967 return std::make_unique<SwSectionFootnoteEndTabPage>(pPage, pController, *rAttrSet);
1968}
1969
1971{
1972 bool bFoot = m_xFootnoteNtAtTextEndCB.get() == &rBox || m_xFootnoteNtNumCB.get() == &rBox ||
1973 m_xFootnoteNtNumFormatCB.get() == &rBox ;
1974
1975 weld::CheckButton *pNumBox, *pNumFormatBox, *pEndBox;
1976 SwNumberingTypeListBox* pNumViewBox;
1977 weld::Label *pOffsetText;
1978 weld::SpinButton *pOffsetField;
1979 weld::Label *pPrefixFT, *pSuffixFT;
1980 weld::Entry *pPrefixED, *pSuffixED;
1981
1982 if( bFoot )
1983 {
1984 pEndBox = m_xFootnoteNtAtTextEndCB.get();
1985 pNumBox = m_xFootnoteNtNumCB.get();
1986 pNumFormatBox = m_xFootnoteNtNumFormatCB.get();
1987 pNumViewBox = m_xFootnoteNumViewBox.get();
1988 pOffsetText = m_xFootnoteOffsetLbl.get();
1989 pOffsetField = m_xFootnoteOffsetField.get();
1990 pPrefixFT = m_xFootnotePrefixFT.get();
1991 pSuffixFT = m_xFootnoteSuffixFT.get();
1992 pPrefixED = m_xFootnotePrefixED.get();
1993 pSuffixED = m_xFootnoteSuffixED.get();
1994 }
1995 else
1996 {
1997 pEndBox = m_xEndNtAtTextEndCB.get();
1998 pNumBox = m_xEndNtNumCB.get();
1999 pNumFormatBox = m_xEndNtNumFormatCB.get();
2000 pNumViewBox = m_xEndNumViewBox.get();
2001 pOffsetText = m_xEndOffsetLbl.get();
2002 pOffsetField = m_xEndOffsetField.get();
2003 pPrefixFT = m_xEndPrefixFT.get();
2004 pSuffixFT = m_xEndSuffixFT.get();
2005 pPrefixED = m_xEndPrefixED.get();
2006 pSuffixED = m_xEndSuffixED.get();
2007 }
2008
2009 bool bEnableAtEnd = TRISTATE_TRUE == pEndBox->get_state();
2010 bool bEnableNum = bEnableAtEnd && TRISTATE_TRUE == pNumBox->get_state();
2011 bool bEnableNumFormat = bEnableNum && TRISTATE_TRUE == pNumFormatBox->get_state();
2012
2013 pNumBox->set_sensitive( bEnableAtEnd );
2014 pOffsetText->set_sensitive( bEnableNum );
2015 pOffsetField->set_sensitive( bEnableNum );
2016 pNumFormatBox->set_sensitive( bEnableNum );
2017 pNumViewBox->set_sensitive( bEnableNumFormat );
2018 pPrefixED->set_sensitive( bEnableNumFormat );
2019 pSuffixED->set_sensitive( bEnableNumFormat );
2020 pPrefixFT->set_sensitive( bEnableNumFormat );
2021 pSuffixFT->set_sensitive( bEnableNumFormat );
2022}
2023
2025 weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh)
2026 : SfxTabDialogController(pParent, "modules/swriter/ui/formatsectiondialog.ui",
2027 "FormatSectionDialog", &rSet)
2028 , m_rWrtSh(rSh)
2029{
2031 AddTabPage("columns", SwColumnPage::Create, nullptr);
2032 AddTabPage("background", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_BKG), nullptr);
2034 AddTabPage("indents", SwSectionIndentTabPage::Create, nullptr);
2035
2037 bool bWeb = dynamic_cast<SwWebDocShell*>( rSh.GetView().GetDocShell() ) != nullptr ;
2038 if(bWeb)
2039 {
2040 RemoveTabPage("notes");
2041 RemoveTabPage("indents");
2042 if( HTML_CFG_NS40 != nHtmlMode && HTML_CFG_WRITER != nHtmlMode)
2043 RemoveTabPage("columns");
2044 }
2045}
2046
2048{
2049}
2050
2052{
2053 if (rId == "background")
2054 {
2055 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
2056 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_SELECTOR)));
2057 rPage.PageCreated(aSet);
2058 }
2059 else if (rId == "columns")
2060 {
2061 static_cast<SwColumnPage&>(rPage).ShowBalance(true);
2062 static_cast<SwColumnPage&>(rPage).SetInSection(true);
2063 }
2064 else if (rId == "indents")
2065 static_cast<SwSectionIndentTabPage&>(rPage).SetWrtShell(m_rWrtSh);
2066}
2067
2069 : SfxTabPage(pPage, pController, "modules/swriter/ui/indentpage.ui", "IndentPage", &rAttrSet)
2070 , m_xBeforeMF(m_xBuilder->weld_metric_spin_button("before", FieldUnit::CM))
2071 , m_xAfterMF(m_xBuilder->weld_metric_spin_button("after", FieldUnit::CM))
2072 , m_xPreviewWin(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWin))
2073{
2075 m_xBeforeMF->connect_value_changed(aLk);
2076 m_xAfterMF->connect_value_changed(aLk);
2077}
2078
2080{
2081}
2082
2084{
2085 if (m_xBeforeMF->get_value_changed_from_saved() || m_xAfterMF->get_value_changed_from_saved())
2086 {
2087 SvxLRSpaceItem aLRSpace(
2088 m_xBeforeMF->denormalize(m_xBeforeMF->get_value(FieldUnit::TWIP)) ,
2089 m_xAfterMF->denormalize(m_xAfterMF->get_value(FieldUnit::TWIP)), 0, RES_LR_SPACE);
2090 rSet->Put(aLRSpace);
2091 }
2092 return true;
2093}
2094
2096{
2097 //this page doesn't show up in HTML mode
2098 FieldUnit aMetric = ::GetDfltMetric(false);
2099 SetFieldUnit(*m_xBeforeMF, aMetric);
2100 SetFieldUnit(*m_xAfterMF , aMetric);
2101
2102 SfxItemState eItemState = rSet->GetItemState( RES_LR_SPACE );
2103 if ( eItemState >= SfxItemState::DEFAULT )
2104 {
2105 const SvxLRSpaceItem& rSpace =
2106 rSet->Get( RES_LR_SPACE );
2107
2108 m_xBeforeMF->set_value(m_xBeforeMF->normalize(rSpace.GetLeft()), FieldUnit::TWIP);
2109 m_xAfterMF->set_value(m_xAfterMF->normalize(rSpace.GetRight()), FieldUnit::TWIP);
2110 }
2111 else
2112 {
2113 m_xBeforeMF->set_text("");
2114 m_xAfterMF->set_text("");
2115 }
2116 m_xBeforeMF->save_value();
2117 m_xAfterMF->save_value();
2118 IndentModifyHdl(*m_xBeforeMF);
2119}
2120
2121std::unique_ptr<SfxTabPage> SwSectionIndentTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet)
2122{
2123 return std::make_unique<SwSectionIndentTabPage>(pPage, pController, *rAttrSet);
2124}
2125
2127{
2128 //set sensible values at the preview
2129 m_aPreviewWin.SetAdjust(SvxAdjust::Block);
2130 m_aPreviewWin.SetLastLine(SvxAdjust::Block);
2131 const SwRect& rPageRect = rSh.GetAnyCurRect( CurRectType::Page );
2132 Size aPageSize(rPageRect.Width(), rPageRect.Height());
2133 m_aPreviewWin.SetSize(aPageSize);
2134}
2135
2137{
2138 m_aPreviewWin.SetLeftMargin(m_xBeforeMF->denormalize(m_xBeforeMF->get_value(FieldUnit::TWIP)));
2139 m_aPreviewWin.SetRightMargin(m_xAfterMF->denormalize(m_xAfterMF->get_value(FieldUnit::TWIP)));
2140 m_aPreviewWin.Invalidate();
2141}
2142
2143/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XExecutableDialog > m_xDialog
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
Provides access to the marks of a document.
virtual const_iterator_t getBookmarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence the IBookmarks.
virtual const_iterator_t getBookmarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of IBookmarks.
static OUString decode(std::u16string_view rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
virtual size_t GetSectionList(SfxMedium &rMedium, std::vector< OUString > &rStrings) const
Definition: shellio.cxx:645
std::unique_ptr< SvxBrushItem > m_Brush
Definition: uiregionsw.cxx:166
bool m_bSelected
Definition: uiregionsw.cxx:176
SwFormatCol m_Col
Definition: uiregionsw.cxx:165
SwSectionData & GetSectionData()
Definition: uiregionsw.cxx:182
SwFormatFootnoteAtTextEnd & GetFootnoteNtAtEnd()
Definition: uiregionsw.cxx:185
bool m_bContent
Definition: uiregionsw.cxx:174
SwFormatCol & GetCol()
Definition: uiregionsw.cxx:183
SwFormatNoBalancedColumns & GetBalance()
Definition: uiregionsw.cxx:187
void SetTempPasswd(const uno::Sequence< sal_Int8 > &rPasswd)
Definition: uiregionsw.cxx:205
void SetFilter(std::u16string_view rFilter)
Definition: uiregionsw.cxx:259
SwFormatNoBalancedColumns m_Balance
Definition: uiregionsw.cxx:169
bool IsContent() const
Definition: uiregionsw.cxx:198
void SetSelected()
Definition: uiregionsw.cxx:201
const size_t m_nArrPos
Definition: uiregionsw.cxx:172
SwFormatFootnoteAtTextEnd m_FootnoteNtAtEnd
Definition: uiregionsw.cxx:167
uno::Sequence< sal_Int8 > & GetTempPasswd()
Definition: uiregionsw.cxx:204
OUString GetSubRegion() const
Definition: uiregionsw.cxx:323
SwFormatEndAtTextEnd & GetEndNtAtEnd()
Definition: uiregionsw.cxx:186
std::shared_ptr< SvxFrameDirectionItem > m_FrameDirItem
Definition: uiregionsw.cxx:170
SwFormatEndAtTextEnd m_EndNtAtEnd
Definition: uiregionsw.cxx:168
void SetContent(bool const bValue)
Definition: uiregionsw.cxx:199
std::shared_ptr< SvxLRSpaceItem > & GetLRSpace()
Definition: uiregionsw.cxx:189
OUString GetFile() const
Definition: uiregionsw.cxx:305
SectRepr(size_t nPos, SwSection &rSect)
Definition: uiregionsw.cxx:209
std::shared_ptr< SvxLRSpaceItem > m_LRSpaceItem
Definition: uiregionsw.cxx:171
bool IsSelected() const
Definition: uiregionsw.cxx:202
SwSectionData m_SectionData
Definition: uiregionsw.cxx:164
std::shared_ptr< SvxFrameDirectionItem > & GetFrameDir()
Definition: uiregionsw.cxx:188
uno::Sequence< sal_Int8 > m_TempPasswd
Definition: uiregionsw.cxx:177
void SetFile(std::u16string_view rFile)
Definition: uiregionsw.cxx:231
std::unique_ptr< SvxBrushItem > & GetBackground()
Definition: uiregionsw.cxx:184
void SetSubRegion(std::u16string_view rSubRegion)
Definition: uiregionsw.cxx:281
size_t GetArrPos() const
Definition: uiregionsw.cxx:191
static SfxAbstractDialogFactory * Create()
virtual CreateTabPage GetTabPageCreatorFunc(sal_uInt16 nId)=0
const css::uno::Reference< css::frame::XDispatchRecorder > & GetRecorder() const
void SetValue(bool const bTheValue)
bool GetValue() const
EnumT GetValue() const
sal_uInt16 Count() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
const INetURLObject & GetURLObject() const
css::uno::Reference< css::embed::XStorage > GetStorage(bool bCreateTempFile=true)
bool IsStorage()
SfxMedium * GetMedium() const
OUString GetPassword() const
virtual short run() override
OUString GetConfirm() const
void ShowExtras(SfxShowExtras nExtras)
void AppendItem(const SfxPoolItem &)
void Done(bool bRemove=false)
virtual short Ok()
void SetCurPageId(const OUString &rName)
void AddTabPage(const OUString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
void RemoveTabPage(const OUString &rName)
virtual short run() override
const SfxItemSet * GetOutputItemSet() const
SfxItemSet * GetInputSetImpl()
virtual void PageCreated(const SfxAllItemSet &aSet)
SfxOkDialogController * GetDialogController() const
weld::Window * GetFrameWeld() const
SfxBindings & GetBindings()
SfxViewFrame & GetViewFrame() const
static SotClipboardFormatId GetFormatID(css::uno::Reference< css::embed::XStorage > const &xStorage)
static SVL_DLLPUBLIC void GetHashPassword(css::uno::Sequence< sal_Int8 > &rPassHash, const char *pPass, sal_uInt32 nLen)
static SVL_DLLPUBLIC bool CompareHashPassword(const css::uno::Sequence< sal_Int8 > &rOldPassHash, std::u16string_view sNewPass)
virtual SvxBrushItem * Clone(SfxItemPool *pPool=nullptr) const override
virtual SvxFrameDirectionItem * Clone(SfxItemPool *pPool=nullptr) const override
tools::Long GetRight() const
virtual SvxLRSpaceItem * Clone(SfxItemPool *pPool=nullptr) const override
tools::Long GetLeft() const
void SetAdjust(SvxAdjust eNew)
void SetSize(Size aNew)
void SetLastLine(SvxAdjust eNew)
tools::Long GetWidth() const
virtual std::unique_ptr< SfxItemSet > Clone(bool bItems=true, SfxItemPool *pToPool=nullptr) const override
Definition: swatrset.cxx:111
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: column.cxx:585
std::unique_ptr< weld::ComboBox > m_xSubRegionED
Definition: regionsw.hxx:67
bool m_bDontCheckPasswd
Definition: regionsw.hxx:55
virtual ~SwEditRegionDlg() override
Definition: uiregionsw.cxx:556
std::unique_ptr< weld::CheckButton > m_xFileCB
Definition: regionsw.hxx:59
SwEditRegionDlg(weld::Window *pParent, SwWrtShell &rWrtSh)
Definition: uiregionsw.cxx:332
std::unique_ptr< weld::Label > m_xFileNameFT
Definition: regionsw.hxx:62
std::unique_ptr< weld::Button > m_xPasswdPB
Definition: regionsw.hxx:70
std::unique_ptr< weld::Entry > m_xFileNameED
Definition: regionsw.hxx:64
void RecurseList(const SwSectionFormat *pFormat, const weld::TreeIter *pIter)
Definition: uiregionsw.cxx:475
SwWrtShell & m_rSh
Definition: regionsw.hxx:50
size_t FindArrPos(const SwSectionFormat *pFormat)
Definition: uiregionsw.cxx:545
const SwSection * m_pCurrSect
Definition: regionsw.hxx:52
std::unique_ptr< weld::CheckButton > m_xDDECB
Definition: regionsw.hxx:60
std::unique_ptr< weld::Button > m_xDismiss
Definition: regionsw.hxx:78
std::unique_ptr< weld::Entry > m_xCurName
Definition: regionsw.hxx:57
std::unique_ptr< ConditionEdit > m_xConditionED
Definition: regionsw.hxx:73
std::unique_ptr< weld::Label > m_xDDECommandFT
Definition: regionsw.hxx:63
std::unique_ptr< weld::CheckButton > m_xProtectCB
Definition: regionsw.hxx:68
std::unique_ptr< weld::Button > m_xOK
Definition: regionsw.hxx:76
std::unique_ptr< weld::CheckButton > m_xPasswdCB
Definition: regionsw.hxx:69
std::unique_ptr< weld::Button > m_xFilePB
Definition: regionsw.hxx:65
bool CheckPasswd(weld::Toggleable *pBox=nullptr)
Definition: uiregionsw.cxx:429
std::unique_ptr< weld::Button > m_xOptionsPB
Definition: regionsw.hxx:77
void ChangePasswd(bool bChange)
std::unique_ptr< weld::TreeView > m_xTree
Definition: regionsw.hxx:58
std::unique_ptr< weld::Widget > m_xHideFrame
Definition: regionsw.hxx:79
void SelectSection(std::u16string_view rSectionName)
Definition: uiregionsw.cxx:568
std::unique_ptr< weld::CheckButton > m_xHideCB
Definition: regionsw.hxx:71
std::unique_ptr< weld::CheckButton > m_xEditInReadonlyCB
Definition: regionsw.hxx:75
size_t GetSectionFormatCount() const
Definition: edsect.cxx:114
SwSection const * InsertSection(SwSectionData &rNewData, SfxItemSet const *const =nullptr)
Definition: edsect.cxx:35
const SwSection * GetCurrSection() const
Definition: edsect.cxx:71
OUString GetUniqueSectionName(const OUString *pChkStr=nullptr) const
Definition: edsect.cxx:166
const SwSectionFormat & GetSectionFormat(size_t nFormat) const
Definition: edsect.cxx:142
const SwRect & GetAnyCurRect(CurRectType eType, const Point *pPt=nullptr, const css::uno::Reference< css::embed::XEmbeddedObject > &=css::uno::Reference< css::embed::XEmbeddedObject >()) const
Definition: fews.cxx:90
SfxPoolItem subclass that is a wrapper around an SwFootnoteEndPosEnum, i.e.
Definition: fmtftntx.hxx:43
void SetNumType(SvxNumType eType)
Definition: fmtftntx.hxx:75
const OUString & GetPrefix() const
Definition: fmtftntx.hxx:82
void SetPrefix(const OUString &rSet)
Definition: fmtftntx.hxx:83
SvxNumType GetNumType() const
Definition: fmtftntx.hxx:74
void SetSuffix(const OUString &rSet)
Definition: fmtftntx.hxx:86
void SetOffset(sal_uInt16 nOff)
Definition: fmtftntx.hxx:80
sal_uInt16 GetOffset() const
Definition: fmtftntx.hxx:79
const OUString & GetSuffix() const
Definition: fmtftntx.hxx:85
If text in multi-column sections should be evenly distributed.
Definition: fmtclbl.hxx:29
const SvxFrameDirectionItem & GetFrameDir(bool=true) const
Definition: frmatr.hxx:118
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:98
const SwFormatFootnoteAtTextEnd & GetFootnoteAtTextEnd(bool=true) const
Definition: fmtftntx.hxx:116
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
const SwFormatEndAtTextEnd & GetEndAtTextEnd(bool=true) const
Definition: fmtftntx.hxx:118
const SwFormatCol & GetCol(bool=true) const
Definition: fmtclds.hxx:168
const SwFormatNoBalancedColumns & GetBalancedColumns(bool=true) const
Definition: fmtclbl.hxx:42
std::unique_ptr< SvxBrushItem > makeBackgroundBrushItem(bool=true) const
Definition: format.cxx:736
size_t GetPos(const SwFormat *p) const
Definition: docary.hxx:162
virtual void PageCreated(const OUString &rId, SfxTabPage &rPage) override
virtual short Ok() override
void SetSectionData(SwSectionData const &rSect)
SwInsertSectionTabDialog(weld::Window *pParent, const SfxItemSet &rSet, SwWrtShell &rSh)
virtual ~SwInsertSectionTabDialog() override
std::unique_ptr< SwSectionData > m_pSectionData
Definition: regionsw.hxx:231
std::unique_ptr< weld::Label > m_xSubRegionFT
Definition: regionsw.hxx:135
SwWrtShell * m_pWrtSh
Definition: regionsw.hxx:125
std::unique_ptr< weld::Button > m_xPasswdPB
Definition: regionsw.hxx:139
std::unique_ptr< weld::Label > m_xFileNameFT
Definition: regionsw.hxx:132
std::unique_ptr< weld::CheckButton > m_xPasswdCB
Definition: regionsw.hxx:138
std::unique_ptr< weld::CheckButton > m_xDDECB
Definition: regionsw.hxx:130
void SetWrtShell(SwWrtShell &rSh)
std::unique_ptr< weld::Entry > m_xFileNameED
Definition: regionsw.hxx:133
std::unique_ptr< weld::CheckButton > m_xFileCB
Definition: regionsw.hxx:129
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
virtual ~SwInsertSectionTabPage() override
void ChangePasswd(bool bChange)
std::unique_ptr< weld::CheckButton > m_xProtectCB
Definition: regionsw.hxx:137
std::unique_ptr< weld::CheckButton > m_xEditInReadonlyCB
Definition: regionsw.hxx:144
std::unique_ptr< weld::Label > m_xDDECommandFT
Definition: regionsw.hxx:131
css::uno::Sequence< sal_Int8 > m_aNewPasswd
Definition: regionsw.hxx:124
std::unique_ptr< weld::EntryTreeView > m_xCurName
Definition: regionsw.hxx:128
std::unique_ptr< ConditionEdit > m_xConditionED
Definition: regionsw.hxx:142
SwInsertSectionTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rAttrSet)
virtual void Reset(const SfxItemSet *) override
std::unique_ptr< weld::Label > m_xConditionFT
Definition: regionsw.hxx:141
virtual bool FillItemSet(SfxItemSet *) override
std::unique_ptr< weld::CheckButton > m_xHideCB
Definition: regionsw.hxx:140
std::unique_ptr< weld::ComboBox > m_xSubRegionED
Definition: regionsw.hxx:136
std::unique_ptr< weld::Button > m_xFilePB
Definition: regionsw.hxx:134
void set_sensitive(bool bEnable)
bool SelectNumberingType(SvxNumType nType)
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
void Height(tools::Long nNew)
Definition: swrect.hxx:193
void Width(tools::Long nNew)
Definition: swrect.hxx:189
bool IsEditInReadonlyFlag() const
Definition: section.hxx:107
void SetHidden(bool const bFlag)
Definition: section.hxx:99
SAL_DLLPRIVATE void SetProtectFlag(bool const bFlag)
Definition: section.hxx:106
void SetEditInReadonlyFlag(bool const bFlag)
Definition: section.hxx:108
const OUString & GetLinkFilePassword() const
Definition: section.hxx:123
void SetSectionName(OUString const &rName)
Definition: section.hxx:94
bool IsProtectFlag() const
Definition: section.hxx:104
void SetType(SectionType const eNew)
Definition: section.hxx:96
SectionType GetType() const
Definition: section.hxx:95
void SetLinkFilePassword(OUString const &rS)
Definition: section.hxx:124
void SetCondition(OUString const &rNew)
Definition: section.hxx:115
void SetLinkFileName(OUString const &rNew)
Definition: section.hxx:118
bool IsHidden() const
Definition: section.hxx:98
const OUString & GetCondition() const
Definition: section.hxx:114
const OUString & GetLinkFileName() const
Definition: section.hxx:117
css::uno::Sequence< sal_Int8 > const & GetPassword() const
Definition: section.hxx:126
void SetPassword(css::uno::Sequence< sal_Int8 > const &rNew)
Definition: section.hxx:128
const OUString & GetSectionName() const
Definition: section.hxx:93
std::unique_ptr< weld::Label > m_xFootnotePrefixFT
Definition: regionsw.hxx:178
std::unique_ptr< weld::Label > m_xEndSuffixFT
Definition: regionsw.hxx:191
SwSectionFootnoteEndTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rAttrSet)
std::unique_ptr< weld::CheckButton > m_xEndNtNumFormatCB
Definition: regionsw.hxx:187
std::unique_ptr< weld::Entry > m_xFootnotePrefixED
Definition: regionsw.hxx:179
std::unique_ptr< weld::CheckButton > m_xFootnoteNtNumCB
Definition: regionsw.hxx:174
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
virtual void Reset(const SfxItemSet *) override
virtual ~SwSectionFootnoteEndTabPage() override
std::unique_ptr< weld::Label > m_xFootnoteOffsetLbl
Definition: regionsw.hxx:175
std::unique_ptr< weld::CheckButton > m_xFootnoteNtNumFormatCB
Definition: regionsw.hxx:177
std::unique_ptr< weld::CheckButton > m_xEndNtAtTextEndCB
Definition: regionsw.hxx:183
std::unique_ptr< weld::SpinButton > m_xFootnoteOffsetField
Definition: regionsw.hxx:176
std::unique_ptr< weld::Entry > m_xFootnoteSuffixED
Definition: regionsw.hxx:182
std::unique_ptr< weld::CheckButton > m_xFootnoteNtAtTextEndCB
Definition: regionsw.hxx:173
void ResetState(bool bFootnote, const SwFormatFootnoteEndAtTextEnd &)
std::unique_ptr< SwNumberingTypeListBox > m_xFootnoteNumViewBox
Definition: regionsw.hxx:180
std::unique_ptr< weld::SpinButton > m_xEndOffsetField
Definition: regionsw.hxx:186
std::unique_ptr< weld::Entry > m_xEndPrefixED
Definition: regionsw.hxx:189
std::unique_ptr< weld::Label > m_xFootnoteSuffixFT
Definition: regionsw.hxx:181
std::unique_ptr< weld::CheckButton > m_xEndNtNumCB
Definition: regionsw.hxx:184
std::unique_ptr< SwNumberingTypeListBox > m_xEndNumViewBox
Definition: regionsw.hxx:190
std::unique_ptr< weld::Entry > m_xEndSuffixED
Definition: regionsw.hxx:192
std::unique_ptr< weld::Label > m_xEndOffsetLbl
Definition: regionsw.hxx:185
virtual bool FillItemSet(SfxItemSet *) override
std::unique_ptr< weld::Label > m_xEndPrefixFT
Definition: regionsw.hxx:188
SwSection * GetSection() const
Definition: section.cxx:646
SwSectionFormat * GetParent() const
Definition: section.hxx:360
void GetChildSections(SwSections &rArr, SectionSort eSort=SectionSort::Not, bool bAllSections=true) const
Definition: section.cxx:853
bool IsInNodesArr() const
Definition: section.cxx:885
Array of Undo-history.
Definition: docary.hxx:193
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
virtual bool FillItemSet(SfxItemSet *) override
std::unique_ptr< weld::MetricSpinButton > m_xAfterMF
Definition: regionsw.hxx:212
std::unique_ptr< weld::MetricSpinButton > m_xBeforeMF
Definition: regionsw.hxx:211
virtual ~SwSectionIndentTabPage() override
virtual void Reset(const SfxItemSet *) override
void SetWrtShell(SwWrtShell const &rSh)
SvxParaPrevWindow m_aPreviewWin
Definition: regionsw.hxx:210
SwSectionIndentTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rAttrSet)
virtual ~SwSectionPropertyTabDialog() override
virtual void PageCreated(const OUString &rId, SfxTabPage &rPage) override
SwSectionPropertyTabDialog(weld::Window *pParent, const SfxItemSet &rSet, SwWrtShell &rSh)
bool IsHidden() const
Definition: section.hxx:181
const OUString & GetSectionName() const
Definition: section.hxx:171
SwSectionFormat * GetFormat()
Definition: section.hxx:341
bool IsProtect() const
Definition: section.cxx:334
SectionType GetType() const
Definition: section.hxx:173
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: viewsh.cxx:2821
SwDocShell * GetDocShell()
Definition: view.cxx:1193
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
const SwView & GetView() const
Definition: wrtsh.hxx:443
virtual void clear()=0
void append_text(const OUString &rStr)
virtual void set_text(const OUString &rText)=0
virtual void set_value(sal_Int64 value)=0
virtual bool get_active() const=0
virtual void set_active(bool active)=0
TriState get_state() const
void set_state(TriState eState)
virtual void set_sensitive(bool sensitive)=0
#define FN_INSERT_REGION
Definition: cmdid.h:301
#define FN_PARAM_REGION_PROTECT
Definition: cmdid.h:813
#define FN_PARAM_REGION_NAME
Definition: cmdid.h:810
#define FN_PARAM_REGION_CONDITION
Definition: cmdid.h:811
#define FN_PARAM_REGION_EDIT_IN_READONLY
Definition: cmdid.h:814
#define FN_PARAM_REGION_HIDDEN
Definition: cmdid.h:812
int nCount
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
float u
#define ERRCODE_NONE
@ Page
Rect of current page.
FieldUnit
Reader * SwGetReaderXML()
Definition: fltini.cxx:89
@ Variable
Frame is variable in Var-direction.
@ FTNEND_ATTXTEND
at end of the current text end
Definition: fmtftntx.hxx:31
@ FTNEND_ATTXTEND_OWNNUMANDFMT
-""- and with own numberformat
Definition: fmtftntx.hxx:33
@ FTNEND_ATTXTEND_OWNNUMSEQ
-""- and with own number sequence
Definition: fmtftntx.hxx:32
@ FTNEND_ATPGORDOCEND
at page or document end
Definition: fmtftntx.hxx:30
SotClipboardFormatId
OUString sName
SvxFrameDirection
TRISTATE_FALSE
TRISTATE_INDET
TRISTATE_TRUE
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(126)
constexpr TypedWhichId< SwFormatEndAtTextEnd > RES_END_AT_TXTEND(124)
constexpr TypedWhichId< SwFormatFootnoteAtTextEnd > RES_FTN_AT_TXTEND(123)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SwFormatCol > RES_COL(115)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(111)
constexpr TypedWhichId< SwFormatNoBalancedColumns > RES_COLUMNBALANCE(125)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(97)
#define HTML_CFG_NS40
#define HTML_CFG_WRITER
static bool bFootnote
Definition: insfnote.cxx:33
OUString aName
sal_Int64 n
sal_uInt16 nPos
aBuf
sal_uInt16 GetExportMode()
SVL_DLLPUBLIC Link< OUString *, bool > const & GetMaybeFileHdl()
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)
int i
std::shared_ptr< T > make_shared(Args &&... args)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
const sal_Unicode cTokenSeparator
const SvxPageUsage aArr[]
long Long
OUString toId(const void *pValue)
SfxItemState
SectionType
Definition: section.hxx:46
std::vector< SwSection * > SwSections
Definition: section.hxx:42
static SfxItemSet & rSet
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168
sal_uInt16 sal_Unicode
IMPL_LINK(SwEditRegionDlg, GetFirstEntryHdl, weld::TreeView &, rBox, void)
Definition: uiregionsw.cxx:590
static void lcl_FillSubRegionList(SwWrtShell &rSh, weld::ComboBox &rSubRegions, weld::ComboBox *pAvailNames)
Definition: uiregionsw.cxx:145
static void lcl_ReadSections(SfxMedium &rMedium, weld::ComboBox &rBox)
IMPL_LINK_NOARG(SwEditRegionDlg, OkHdl, weld::Button &, void)
Definition: uiregionsw.cxx:751
static void lcl_FillList(SwWrtShell &rSh, weld::ComboBox &rSubRegions, weld::ComboBox *pAvailNames, const SwSectionFormat *pNewFormat)
Definition: uiregionsw.cxx:98
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:756
SVT_DLLPUBLIC void SetFieldUnit(weld::MetricSpinButton &rCtrl, FieldUnit eUnit, bool bAll=false)
OUString sId
RET_OK
RET_NO
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLUSESLIDEBACKGROUND)