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
40#include <uitool.hxx>
41#include <IMark.hxx>
42#include <section.hxx>
43#include <docary.hxx>
44#include <doc.hxx>
45#include <wdocsh.hxx>
46#include <view.hxx>
47#include <wrtsh.hxx>
48#include <column.hxx>
49#include <fmtclbl.hxx>
50#include <fmtfsize.hxx>
51#include <frmatr.hxx>
52#include <shellio.hxx>
53
54#include <cmdid.h>
55#include <strings.hrc>
56#include <bitmaps.hlst>
57#include <sfx2/bindings.hxx>
58#include <sfx2/sfxdlg.hxx>
59#include <sfx2/viewfrm.hxx>
60#include <svx/dialogs.hrc>
61#include <svx/flagsdef.hxx>
62#include <memory>
63#include <string_view>
64
65using namespace ::com::sun::star;
66
67namespace {
68
69OUString BuildBitmap(bool bProtect, bool bHidden)
70{
71 if (bProtect)
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);
74}
75
76OUString CollapseWhiteSpaces(std::u16string_view sName)
77{
78 const sal_Int32 nLen = sName.size();
79 const sal_Unicode cRef = ' ';
80 OUStringBuffer aBuf(nLen);
81 for (sal_Int32 i = 0; i<nLen; )
82 {
83 const sal_Unicode cCur = sName[i++];
84 aBuf.append(cCur);
85 if (cCur!=cRef)
86 continue;
87 while (i<nLen && sName[i]==cRef)
88 ++i;
89 }
90 return aBuf.makeStringAndClear();
91}
92
93}
94
95static void lcl_ReadSections( SfxMedium& rMedium, weld::ComboBox& rBox );
96
97static void lcl_FillList( SwWrtShell& rSh, weld::ComboBox& rSubRegions, weld::ComboBox* pAvailNames, const SwSectionFormat* pNewFormat )
98{
99 if( !pNewFormat )
100 {
101 const size_t nCount = rSh.GetSectionFormatCount();
102 for (size_t i = 0; i<nCount; i++)
103 {
104 SectionType eTmpType;
105 const SwSectionFormat* pFormat = &rSh.GetSectionFormat(i);
106 if( !pFormat->GetParent() &&
107 pFormat->IsInNodesArr() &&
108 (eTmpType = pFormat->GetSection()->GetType()) != SectionType::ToxContent
109 && SectionType::ToxHeader != eTmpType )
110 {
111 const OUString sString(pFormat->GetSection()->GetSectionName());
112 if (pAvailNames)
113 pAvailNames->append_text(sString);
114 rSubRegions.append_text(sString);
115 lcl_FillList( rSh, rSubRegions, pAvailNames, pFormat );
116 }
117 }
118 }
119 else
120 {
121 SwSections aTmpArr;
122 pNewFormat->GetChildSections(aTmpArr, SectionSort::Pos);
123 if( !aTmpArr.empty() )
124 {
125 SectionType eTmpType;
126 for( const auto pSect : aTmpArr )
127 {
128 const SwSectionFormat* pFormat = pSect->GetFormat();
129 if( pFormat->IsInNodesArr()&&
130 (eTmpType = pFormat->GetSection()->GetType()) != SectionType::ToxContent
131 && SectionType::ToxHeader != eTmpType )
132 {
133 const OUString sString(pFormat->GetSection()->GetSectionName());
134 if (pAvailNames)
135 pAvailNames->append_text(sString);
136 rSubRegions.append_text(sString);
137 lcl_FillList( rSh, rSubRegions, pAvailNames, pFormat );
138 }
139 }
140 }
141 }
142}
143
144static void lcl_FillSubRegionList( SwWrtShell& rSh, weld::ComboBox& rSubRegions, weld::ComboBox* pAvailNames )
145{
146 rSubRegions.clear();
147 lcl_FillList( rSh, rSubRegions, pAvailNames, nullptr );
148 IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
149 for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getBookmarksBegin();
150 ppMark != pMarkAccess->getBookmarksEnd();
151 ++ppMark)
152 {
153 const ::sw::mark::IMark* pBkmk = *ppMark;
154 if( pBkmk->IsExpanded() )
155 rSubRegions.append_text( pBkmk->GetName() );
156 }
157}
158
159// user data class for region information
161{
162private:
165 std::unique_ptr<SvxBrushItem> m_Brush;
169 std::shared_ptr<SvxFrameDirectionItem> m_FrameDirItem;
170 std::shared_ptr<SvxLRSpaceItem> m_LRSpaceItem;
171 const size_t m_nArrPos;
172 // shows, if maybe textcontent is in the region
173 bool m_bContent : 1;
174 // for multiselection, mark at first, then work with TreeListBox!
175 bool m_bSelected : 1;
176 uno::Sequence<sal_Int8> m_TempPasswd;
177
178public:
179 SectRepr(size_t nPos, SwSection& rSect);
180
182 SwFormatCol& GetCol() { return m_Col; }
183 std::unique_ptr<SvxBrushItem>& GetBackground() { return m_Brush; }
187 std::shared_ptr<SvxFrameDirectionItem>& GetFrameDir() { return m_FrameDirItem; }
188 std::shared_ptr<SvxLRSpaceItem>& GetLRSpace() { return m_LRSpaceItem; }
189
190 size_t GetArrPos() const { return m_nArrPos; }
191 OUString GetFile() const;
192 OUString GetSubRegion() const;
193 void SetFile(std::u16string_view rFile);
194 void SetFilter(std::u16string_view rFilter);
195 void SetSubRegion(std::u16string_view rSubRegion);
196
197 bool IsContent() const { return m_bContent; }
198 void SetContent(bool const bValue) { m_bContent = bValue; }
199
200 void SetSelected() { m_bSelected = true; }
201 bool IsSelected() const { return m_bSelected; }
202
203 uno::Sequence<sal_Int8> & GetTempPasswd() { return m_TempPasswd; }
204 void SetTempPasswd(const uno::Sequence<sal_Int8> & rPasswd)
205 { m_TempPasswd = rPasswd; }
206};
207
208SectRepr::SectRepr( size_t nPos, SwSection& rSect )
209 : m_SectionData( rSect )
210 , m_Brush(std::make_unique<SvxBrushItem>(RES_BACKGROUND))
212 , m_LRSpaceItem(std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE))
213 , m_nArrPos(nPos)
214 , m_bContent(m_SectionData.GetLinkFileName().isEmpty())
215 , m_bSelected(false)
216{
217 SwSectionFormat *pFormat = rSect.GetFormat();
218 if( pFormat )
219 {
220 m_Col = pFormat->GetCol();
221 m_Brush = pFormat->makeBackgroundBrushItem();
223 m_EndNtAtEnd = pFormat->GetEndAtTextEnd();
225 m_FrameDirItem.reset(pFormat->GetFrameDir().Clone());
226 m_LRSpaceItem.reset(pFormat->GetLRSpace().Clone());
227 }
228}
229
230void SectRepr::SetFile( std::u16string_view rFile )
231{
232 OUString sNewFile( INetURLObject::decode( rFile,
234 const OUString sOldFileName( m_SectionData.GetLinkFileName() );
235 const std::u16string_view sSub( o3tl::getToken(sOldFileName, 2, sfx2::cTokenSeparator ) );
236
237 if( !rFile.empty() || !sSub.empty() )
238 {
239 sNewFile += OUStringChar(sfx2::cTokenSeparator);
240 if( !rFile.empty() ) // Filter only with FileName
241 sNewFile += o3tl::getToken(sOldFileName, 1, sfx2::cTokenSeparator );
242
243 sNewFile += OUStringChar(sfx2::cTokenSeparator) + sSub;
244 }
245
246 m_SectionData.SetLinkFileName( sNewFile );
247
248 if( !rFile.empty() || !sSub.empty() )
249 {
251 }
252 else
253 {
255 }
256}
257
258void SectRepr::SetFilter( std::u16string_view rFilter )
259{
260 OUString sNewFile;
261 const OUString sOldFileName( m_SectionData.GetLinkFileName() );
262 sal_Int32 nIdx{ 0 };
263 const std::u16string_view sFile( o3tl::getToken(sOldFileName, 0, sfx2::cTokenSeparator, nIdx ) ); // token 0
264 const std::u16string_view sSub( o3tl::getToken(sOldFileName, 1, sfx2::cTokenSeparator, nIdx ) ); // token 2
265
266 if( !sFile.empty() )
267 sNewFile = sFile + OUStringChar(sfx2::cTokenSeparator) +
268 rFilter + OUStringChar(sfx2::cTokenSeparator) + sSub;
269 else if( !sSub.empty() )
270 sNewFile = OUStringChar(sfx2::cTokenSeparator) + OUStringChar(sfx2::cTokenSeparator) + sSub;
271
272 m_SectionData.SetLinkFileName( sNewFile );
273
274 if( !sNewFile.isEmpty() )
275 {
277 }
278}
279
280void SectRepr::SetSubRegion(std::u16string_view rSubRegion)
281{
282 OUString sNewFile;
283 sal_Int32 n(0);
284 const OUString sLinkFileName(m_SectionData.GetLinkFileName());
285 const std::u16string_view sOldFileName( o3tl::getToken(sLinkFileName, 0, sfx2::cTokenSeparator, n ) );
286 const std::u16string_view sFilter( o3tl::getToken(sLinkFileName, 0, sfx2::cTokenSeparator, n ) );
287
288 if( !rSubRegion.empty() || !sOldFileName.empty() )
289 sNewFile = sOldFileName + OUStringChar(sfx2::cTokenSeparator) +
290 sFilter + OUStringChar(sfx2::cTokenSeparator) + rSubRegion;
291
292 m_SectionData.SetLinkFileName( sNewFile );
293
294 if( !rSubRegion.empty() || !sOldFileName.empty() )
295 {
297 }
298 else
299 {
301 }
302}
303
304OUString SectRepr::GetFile() const
305{
306 const OUString sLinkFile( m_SectionData.GetLinkFileName() );
307
308 if( sLinkFile.isEmpty() )
309 {
310 return sLinkFile;
311 }
313 {
314 sal_Int32 n = 0;
315 return sLinkFile.replaceFirst( OUStringChar(sfx2::cTokenSeparator), " ", &n )
316 .replaceFirst( OUStringChar(sfx2::cTokenSeparator), " ", &n );
317 }
320}
321
323{
324 const OUString sLinkFile( m_SectionData.GetLinkFileName() );
325 if( !sLinkFile.isEmpty() )
326 return sLinkFile.getToken( 2, sfx2::cTokenSeparator );
327 return sLinkFile;
328}
329
330// dialog edit regions
332 : SfxDialogController(pParent, "modules/swriter/ui/editsectiondialog.ui",
333 "EditSectionDialog")
334 , m_bSubRegionsFilled(false)
335 , m_rSh(rWrtSh)
336 , m_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"))
359{
360 m_xTree->set_size_request(-1, m_xTree->get_height_rows(16));
361 m_xFileCB->set_state(TRISTATE_FALSE);
362 m_xSubRegionED->make_sorted();
363 m_xProtectCB->set_state(TRISTATE_FALSE);
364 m_xHideCB->set_state(TRISTATE_FALSE);
365 // edit in readonly sections
367
368 bool bWeb = dynamic_cast<SwWebDocShell*>( m_rSh.GetView().GetDocShell() ) != nullptr;
369
370 m_xTree->connect_changed(LINK(this, SwEditRegionDlg, GetFirstEntryHdl));
371 m_xCurName->connect_changed(LINK(this, SwEditRegionDlg, NameEditHdl));
372 m_xConditionED->connect_changed( LINK( this, SwEditRegionDlg, ConditionEditHdl));
373 m_xOK->connect_clicked( LINK( this, SwEditRegionDlg, OkHdl));
374 m_xPasswdCB->connect_toggled(LINK(this, SwEditRegionDlg, TogglePasswdHdl));
375 m_xPasswdPB->connect_clicked(LINK(this, SwEditRegionDlg, ChangePasswdHdl));
376 m_xHideCB->connect_toggled(LINK(this, SwEditRegionDlg, ChangeHideHdl));
377 // edit in readonly sections
378 m_xEditInReadonlyCB->connect_toggled(LINK(this, SwEditRegionDlg, ChangeEditInReadonlyHdl));
379
380 m_xOptionsPB->connect_clicked(LINK(this, SwEditRegionDlg, OptionsHdl));
381 m_xProtectCB->connect_toggled(LINK(this, SwEditRegionDlg, ChangeProtectHdl));
382 m_xDismiss->connect_clicked( LINK( this, SwEditRegionDlg, ChangeDismissHdl));
383 m_xFileCB->connect_toggled(LINK(this, SwEditRegionDlg, UseFileHdl));
384 m_xFilePB->connect_clicked(LINK(this, SwEditRegionDlg, FileSearchHdl));
385 m_xFileNameED->connect_changed(LINK(this, SwEditRegionDlg, FileNameEntryHdl));
386 m_xSubRegionED->connect_changed(LINK(this, SwEditRegionDlg, FileNameComboBoxHdl));
387 m_xSubRegionED->connect_popup_toggled(LINK(this, SwEditRegionDlg, SubRegionEventHdl));
388 m_xSubRegionED->set_entry_completion(true, true);
389
390 m_xTree->set_selection_mode(SelectionMode::Multiple);
391
392 if (bWeb)
393 {
394 m_xDDECB->hide();
395 m_xHideFrame->hide();
396 m_xPasswdCB->hide();
397 }
398
399 m_xDDECB->connect_toggled(LINK(this, SwEditRegionDlg, DDEHdl));
400
402 RecurseList( nullptr, nullptr );
403
404 // if the cursor is not in a region the first one will always be selected
405 if (!m_xTree->get_selected(nullptr))
406 {
407 std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
408 if (m_xTree->get_iter_first(*xIter))
409 {
410 m_xTree->select(*xIter);
411 GetFirstEntryHdl(*m_xTree);
412 }
413 }
414
415 m_xTree->show();
416 m_bDontCheckPasswd = false;
417}
418
420{
422 return true;
423 bool bRet = true;
424
425 m_xTree->selected_foreach([this, &bRet](weld::TreeIter& rEntry){
426 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
427 if (!pRepr->GetTempPasswd().hasElements()
428 && pRepr->GetSectionData().GetPassword().hasElements())
429 {
430 SfxPasswordDialog aPasswdDlg(m_xDialog.get());
431 bRet = false;
432 if (aPasswdDlg.run())
433 {
434 const OUString sNewPasswd(aPasswdDlg.GetPassword());
435 css::uno::Sequence <sal_Int8 > aNewPasswd;
436 SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
438 pRepr->GetSectionData().GetPassword(), sNewPasswd))
439 {
440 pRepr->SetTempPasswd(aNewPasswd);
441 bRet = true;
442 }
443 else
444 {
445 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
446 VclMessageType::Info, VclButtonsType::Ok,
447 SwResId(STR_WRONG_PASSWORD)));
448 xInfoBox->run();
449 }
450 }
451 }
452 return false;
453 });
454 if (!bRet && pBox)
455 {
456 //reset old button state
457 if (pBox->get_state() != TRISTATE_INDET)
458 pBox->set_active(!pBox->get_active());
459 }
460
461 return bRet;
462}
463
464// recursively look for child-sections
466{
467 std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
468 if (!pFormat)
469 {
470 const size_t nCount=m_rSh.GetSectionFormatCount();
471 for ( size_t n = 0; n < nCount; n++ )
472 {
473 SectionType eTmpType;
474 if( !( pFormat = &m_rSh.GetSectionFormat(n))->GetParent() &&
475 pFormat->IsInNodesArr() &&
476 (eTmpType = pFormat->GetSection()->GetType()) != SectionType::ToxContent
477 && SectionType::ToxHeader != eTmpType )
478 {
479 SwSection *pSect = pFormat->GetSection();
480 SectRepr* pSectRepr = new SectRepr( n, *pSect );
481
482 OUString sText(pSect->GetSectionName());
483 OUString sImage(BuildBitmap(pSect->IsProtect(),pSect->IsHidden()));
484 OUString sId(weld::toId(pSectRepr));
485 m_xTree->insert(nullptr, -1, &sText, &sId, nullptr, nullptr, false, xIter.get());
486 m_xTree->set_image(*xIter, sImage);
487
488 RecurseList(pFormat, xIter.get());
489 if (m_xTree->iter_has_child(*xIter))
490 m_xTree->expand_row(*xIter);
491 if (m_pCurrSect==pSect)
492 {
493 m_xTree->select(*xIter);
494 m_xTree->scroll_to_row(*xIter);
495 GetFirstEntryHdl(*m_xTree);
496 }
497 }
498 }
499 }
500 else
501 {
502 SwSections aTmpArr;
503 pFormat->GetChildSections(aTmpArr, SectionSort::Pos);
504 for( const auto pSect : aTmpArr )
505 {
506 SectionType eTmpType;
507 pFormat = pSect->GetFormat();
508 if( pFormat->IsInNodesArr() &&
509 (eTmpType = pFormat->GetSection()->GetType()) != SectionType::ToxContent
510 && SectionType::ToxHeader != eTmpType )
511 {
512 SectRepr* pSectRepr=new SectRepr(
513 FindArrPos( pSect->GetFormat() ), *pSect );
514
515 OUString sText(pSect->GetSectionName());
516 OUString sImage = BuildBitmap(pSect->IsProtect(), pSect->IsHidden());
517 OUString sId(weld::toId(pSectRepr));
518 m_xTree->insert(pEntry, -1, &sText, &sId, nullptr, nullptr, false, xIter.get());
519 m_xTree->set_image(*xIter, sImage);
520
521 RecurseList(pSect->GetFormat(), xIter.get());
522 if (m_xTree->iter_has_child(*xIter))
523 m_xTree->expand_row(*xIter);
524 if (m_pCurrSect==pSect)
525 {
526 m_xTree->select(*xIter);
527 m_xTree->scroll_to_row(*xIter);
528 GetFirstEntryHdl(*m_xTree);
529 }
530 }
531 }
532 }
533}
534
536{
537 const size_t nCount=m_rSh.GetSectionFormatCount();
538 for ( size_t i = 0; i < nCount; i++ )
539 if ( pFormat == &m_rSh.GetSectionFormat(i) )
540 return i;
541
542 OSL_FAIL("SectionFormat not on the list" );
543 return SIZE_MAX;
544}
545
547{
548 std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
549 if (m_xTree->get_iter_first(*xIter))
550 {
551 do
552 {
553 delete weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
554 } while (m_xTree->iter_next(*xIter));
555 }
556}
557
558void SwEditRegionDlg::SelectSection(std::u16string_view rSectionName)
559{
560 std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
561 if (!m_xTree->get_iter_first(*xIter))
562 return;
563
564 do
565 {
566 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
567 if (pRepr->GetSectionData().GetSectionName() == rSectionName)
568 {
569 m_xTree->unselect_all();
570 m_xTree->select(*xIter);
571 m_xTree->scroll_to_row(*xIter);
572 GetFirstEntryHdl(*m_xTree);
573 break;
574 }
575 } while (m_xTree->iter_next(*xIter));
576}
577
578// selected entry in TreeListBox is showed in Edit window in case of
579// multiselection some controls are disabled
580IMPL_LINK(SwEditRegionDlg, GetFirstEntryHdl, weld::TreeView&, rBox, void)
581{
582 m_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);
586 // edit in readonly sections
587 m_xEditInReadonlyCB->set_sensitive(true);
588
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())
593 {
594 m_xHideCB->set_state(TRISTATE_INDET);
595 m_xProtectCB->set_state(TRISTATE_INDET);
596 // edit in readonly sections
597 m_xEditInReadonlyCB->set_state(TRISTATE_INDET);
598 m_xFileCB->set_state(TRISTATE_INDET);
599
600 bool bHiddenValid = true;
601 bool bProtectValid = true;
602 bool bConditionValid = true;
603 // edit in readonly sections
604 bool bEditInReadonlyValid = true;
605 bool bEditInReadonly = true;
606
607 bool bHidden = true;
608 bool bProtect = true;
609 OUString sCondition;
610 bool bFirst = true;
611 bool bFileValid = true;
612 bool bFile = true;
613 bool bPasswdValid = true;
614
615 m_xTree->selected_foreach([&](weld::TreeIter& rEntry){
616 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
617 SwSectionData const& rData( pRepr->GetSectionData() );
618 if(bFirst)
619 {
620 sCondition = rData.GetCondition();
621 bHidden = rData.IsHidden();
622 bProtect = rData.IsProtectFlag();
623 // edit in readonly sections
624 bEditInReadonly = rData.IsEditInReadonlyFlag();
625
626 bFile = (rData.GetType() != SectionType::Content);
627 aCurPasswd = rData.GetPassword();
628 }
629 else
630 {
631 if(sCondition != rData.GetCondition())
632 bConditionValid = false;
633 bHiddenValid = (bHidden == rData.IsHidden());
634 bProtectValid = (bProtect == rData.IsProtectFlag());
635 // edit in readonly sections
636 bEditInReadonlyValid =
637 (bEditInReadonly == rData.IsEditInReadonlyFlag());
638
639 bFileValid = (bFile ==
640 (rData.GetType() != SectionType::Content));
641 bPasswdValid = (aCurPasswd == rData.GetPassword());
642 }
643 bFirst = false;
644 return false;
645 });
646
647 m_xHideCB->set_state(!bHiddenValid ? TRISTATE_INDET :
648 bHidden ? TRISTATE_TRUE : TRISTATE_FALSE);
649 m_xProtectCB->set_state(!bProtectValid ? TRISTATE_INDET :
650 bProtect ? TRISTATE_TRUE : TRISTATE_FALSE);
651 // edit in readonly sections
652 m_xEditInReadonlyCB->set_state(!bEditInReadonlyValid ? TRISTATE_INDET :
653 bEditInReadonly ? TRISTATE_TRUE : TRISTATE_FALSE);
654
655 m_xFileCB->set_state(!bFileValid ? TRISTATE_INDET :
656 bFile ? TRISTATE_TRUE : TRISTATE_FALSE);
657
658 if (bConditionValid)
659 m_xConditionED->set_text(sCondition);
660 else
661 {
662 m_xConditionFT->set_sensitive(false);
663 m_xConditionED->set_sensitive(false);
664 }
665
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);
673 if(!bPasswdValid)
674 {
675 rBox.get_selected(xIter.get());
676 rBox.unselect_all();
677 rBox.select(*xIter);
678 GetFirstEntryHdl(rBox);
679 return;
680 }
681 else
682 m_xPasswdCB->set_active(aCurPasswd.hasElements());
683 }
684 else if (bEntry )
685 {
686 m_xCurName->set_sensitive(true);
687 m_xOptionsPB->set_sensitive(true);
688 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
689 SwSectionData const& rData( pRepr->GetSectionData() );
690 m_xConditionED->set_text(rData.GetCondition());
691 m_xHideCB->set_sensitive(true);
692 m_xHideCB->set_state((rData.IsHidden()) ? TRISTATE_TRUE : TRISTATE_FALSE);
693 bool bHide = TRISTATE_TRUE == m_xHideCB->get_state();
694 m_xConditionED->set_sensitive(bHide);
695 m_xConditionFT->set_sensitive(bHide);
696 m_xPasswdCB->set_active(rData.GetPassword().hasElements());
697
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();
704 const OUString sSub = pRepr->GetSubRegion();
705 m_xSubRegionED->clear();
706 m_xSubRegionED->append_text(""); // put in a dummy entry, which is replaced when m_bSubRegionsFilled is set
707 m_bSubRegionsFilled = false;
708 if( !aFile.isEmpty() || !sSub.isEmpty() )
709 {
710 m_xFileCB->set_active(true);
711 m_xFileNameED->set_text(aFile);
712 m_xSubRegionED->set_entry_text(sSub);
713 m_xDDECB->set_active(rData.GetType() == SectionType::DdeLink);
714 }
715 else
716 {
717 m_xFileCB->set_active(false);
718 m_xFileNameED->set_text(aFile);
719 m_xDDECB->set_sensitive(false);
720 m_xDDECB->set_active(false);
721 }
722 UseFileHdl(*m_xFileCB);
723 DDEHdl(*m_xDDECB);
724 m_xProtectCB->set_state((rData.IsProtectFlag())
726 m_xProtectCB->set_sensitive(true);
727
728 // edit in readonly sections
729 m_xEditInReadonlyCB->set_state((rData.IsEditInReadonlyFlag())
731 m_xEditInReadonlyCB->set_sensitive(true);
732
733 bool bPasswdEnabled = m_xProtectCB->get_active();
734 m_xPasswdCB->set_sensitive(bPasswdEnabled);
735 m_xPasswdPB->set_sensitive(bPasswdEnabled);
736 }
737 m_bDontCheckPasswd = false;
738}
739
740// in OkHdl the modified settings are being applied and reversed regions are deleted
742{
743 // temp. Array because during changing of a region the position
744 // inside of the "Core-Arrays" can be shifted:
745 // - at linked regions, when they have more SubRegions or get
746 // new ones.
747 // StartUndo must certainly also happen not before the formats
748 // are copied (ClearRedo!)
749
750 const SwSectionFormats& rDocFormats = m_rSh.GetDoc()->GetSections();
751 SwSectionFormats aOrigArray(rDocFormats);
752
753 m_rSh.StartAllAction();
754 m_rSh.StartUndo();
755 m_rSh.ResetSelect( nullptr,false );
756
757 std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
758 if (m_xTree->get_iter_first(*xIter))
759 {
760 do
761 {
762 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
763 SwSectionFormat* pFormat = aOrigArray[ pRepr->GetArrPos() ];
764 if (!pRepr->GetSectionData().IsProtectFlag())
765 {
766 pRepr->GetSectionData().SetPassword(uno::Sequence<sal_Int8 >());
767 }
768 size_t nNewPos = rDocFormats.GetPos(pFormat);
769 if ( SIZE_MAX != nNewPos )
770 {
771 std::unique_ptr<SfxItemSet> pSet(pFormat->GetAttrSet().Clone( false ));
772 if( pFormat->GetCol() != pRepr->GetCol() )
773 pSet->Put( pRepr->GetCol() );
774
775 std::unique_ptr<SvxBrushItem> aBrush(pFormat->makeBackgroundBrushItem(false));
776 if( pRepr->GetBackground() && *aBrush != *pRepr->GetBackground() )
777 pSet->Put( *pRepr->GetBackground() );
778
779 if( pFormat->GetFootnoteAtTextEnd(false) != pRepr->GetFootnoteNtAtEnd() )
780 pSet->Put( pRepr->GetFootnoteNtAtEnd() );
781
782 if( pFormat->GetEndAtTextEnd(false) != pRepr->GetEndNtAtEnd() )
783 pSet->Put( pRepr->GetEndNtAtEnd() );
784
785 if( pFormat->GetBalancedColumns() != pRepr->GetBalance() )
786 pSet->Put( pRepr->GetBalance() );
787
788 if( pFormat->GetFrameDir() != *pRepr->GetFrameDir() )
789 pSet->Put( *pRepr->GetFrameDir() );
790
791 if( pFormat->GetLRSpace() != *pRepr->GetLRSpace())
792 pSet->Put( *pRepr->GetLRSpace());
793
794 m_rSh.UpdateSection( nNewPos, pRepr->GetSectionData(),
795 pSet->Count() ? pSet.get() : nullptr );
796 }
797 } while (m_xTree->iter_next(*xIter));
798 }
799
800 for (SectReprs_t::reverse_iterator it = m_SectReprs.rbegin(), aEnd = m_SectReprs.rend(); it != aEnd; ++it)
801 {
802 assert(it->first == it->second->GetArrPos());
803 SwSectionFormat* pFormat = aOrigArray[ it->second->GetArrPos() ];
804 const size_t nNewPos = rDocFormats.GetPos( pFormat );
805 if( SIZE_MAX != nNewPos )
806 m_rSh.DelSectionFormat( nNewPos );
807 }
808
809 aOrigArray.clear();
810
811 // response must be called ahead of EndAction's end,
812 // otherwise ScrollError can occur.
813 m_xDialog->response(RET_OK);
814
815 m_rSh.EndUndo();
816 m_rSh.EndAllAction();
817}
818
819// Toggle protect
820IMPL_LINK(SwEditRegionDlg, ChangeProtectHdl, weld::Toggleable&, rButton, void)
821{
822 if (!CheckPasswd(&rButton))
823 return;
824 bool bCheck = TRISTATE_TRUE == rButton.get_state();
825 m_xTree->selected_foreach([this, bCheck](weld::TreeIter& rEntry){
826 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
827 pRepr->GetSectionData().SetProtectFlag(bCheck);
828 OUString aImage = BuildBitmap(bCheck, TRISTATE_TRUE == m_xHideCB->get_state());
829 m_xTree->set_image(rEntry, aImage);
830 return false;
831 });
832 m_xPasswdCB->set_sensitive(bCheck);
833 m_xPasswdPB->set_sensitive(bCheck);
834}
835
836// Toggle hide
837IMPL_LINK( SwEditRegionDlg, ChangeHideHdl, weld::Toggleable&, rButton, void)
838{
839 if (!CheckPasswd(&rButton))
840 return;
841 m_xTree->selected_foreach([this, &rButton](weld::TreeIter& rEntry){
842 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
843 pRepr->GetSectionData().SetHidden(TRISTATE_TRUE == rButton.get_state());
844 OUString aImage = BuildBitmap(TRISTATE_TRUE == m_xProtectCB->get_state(),
845 TRISTATE_TRUE == rButton.get_state());
846 m_xTree->set_image(rEntry, aImage);
847 return false;
848 });
849 bool bHide = TRISTATE_TRUE == rButton.get_state();
850 m_xConditionED->set_sensitive(bHide);
851 m_xConditionFT->set_sensitive(bHide);
852}
853
854// Toggle edit in readonly
855IMPL_LINK(SwEditRegionDlg, ChangeEditInReadonlyHdl, weld::Toggleable&, rButton, void)
856{
857 if (!CheckPasswd(&rButton))
858 return;
859 m_xTree->selected_foreach([this, &rButton](weld::TreeIter& rEntry){
860 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
862 TRISTATE_TRUE == rButton.get_state());
863 return false;
864 });
865}
866
867// clear selected region
869{
870 if(!CheckPasswd())
871 return;
872 // at first mark all selected
873 m_xTree->selected_foreach([this](weld::TreeIter& rEntry){
874 SectRepr* const pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
875 pSectRepr->SetSelected();
876 return false;
877 });
878
879 std::unique_ptr<weld::TreeIter> xEntry(m_xTree->make_iterator());
880 bool bEntry(m_xTree->get_selected(xEntry.get()));
881 // then delete
882 while (bEntry)
883 {
884 SectRepr* const pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xEntry));
885 std::unique_ptr<weld::TreeIter> xRemove;
886 bool bRestart = false;
887 if (pSectRepr->IsSelected())
888 {
889 m_SectReprs.insert(std::make_pair(pSectRepr->GetArrPos(),
890 std::unique_ptr<SectRepr>(pSectRepr)));
891 if (m_xTree->iter_has_child(*xEntry))
892 {
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))
897 xParent.reset();
898 bool bChild = true;
899 do
900 {
901 // because of the repositioning we have to start at the beginning again
902 bRestart = true;
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));
906 } while (bChild);
907 }
908 xRemove = m_xTree->make_iterator(xEntry.get());
909 }
910 if (bRestart)
911 bEntry = m_xTree->get_iter_first(*xEntry);
912 else
913 bEntry = m_xTree->iter_next(*xEntry);
914 if (xRemove)
915 m_xTree->remove(*xRemove);
916 }
917
918 if (m_xTree->get_selected(nullptr))
919 return;
920
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);
928 // edit in readonly sections
929 m_xEditInReadonlyCB->set_sensitive(false);
930 m_xEditInReadonlyCB->set_state(TRISTATE_FALSE);
931 m_xProtectCB->set_state(TRISTATE_FALSE);
932 m_xPasswdCB->set_active(false);
933 m_xHideCB->set_state(TRISTATE_FALSE);
934 m_xFileCB->set_active(false);
935 // otherwise the focus would be on HelpButton
936 m_xOK->grab_focus();
937 UseFileHdl(*m_xFileCB);
938}
939
940// link CheckBox to file?
941IMPL_LINK(SwEditRegionDlg, UseFileHdl, weld::Toggleable&, rButton, void)
942{
943 if (!CheckPasswd(&rButton))
944 return;
945 bool bMulti = 1 < m_xTree->count_selected_rows();
946 bool bFile = rButton.get_active();
947 if (m_xTree->get_selected(nullptr))
948 {
949 m_xTree->selected_foreach([&](weld::TreeIter& rEntry){
950 SectRepr* const pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
951 bool bContent = pSectRepr->IsContent();
952 if( rButton.get_active() && bContent && m_rSh.HasSelection() )
953 {
954 std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(m_xDialog.get(),
955 VclMessageType::Question, VclButtonsType::YesNo,
956 SwResId(STR_QUERY_CONNECT)));
957 if (RET_NO == xQueryBox->run())
958 rButton.set_active( false );
959 }
960 if( bFile )
961 pSectRepr->SetContent(false);
962 else
963 {
964 pSectRepr->SetFile(u"");
965 pSectRepr->SetSubRegion(std::u16string_view());
966 pSectRepr->GetSectionData().SetLinkFilePassword(OUString());
967 }
968 return false;
969 });
970 m_xDDECB->set_sensitive(bFile && !bMulti);
971 m_xDDEFrame->set_sensitive(bFile && !bMulti);
972 if( bFile )
973 {
974 m_xProtectCB->set_state(TRISTATE_TRUE);
975 m_xFileNameED->grab_focus();
976
977 }
978 else
979 {
980 m_xDDECB->set_active(false);
981 m_xSubRegionED->set_entry_text(OUString());
982 }
983 DDEHdl(*m_xDDECB);
984 }
985 else
986 {
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);
992 }
993}
994
995// call dialog paste file
997{
998 if(!CheckPasswd())
999 return;
1000 m_pDocInserter.reset(new ::sfx2::DocumentInserter(m_xDialog.get(), "swriter"));
1001 m_pDocInserter->StartExecuteModal( LINK( this, SwEditRegionDlg, DlgClosedHdl ) );
1002}
1003
1005{
1006 if(!CheckPasswd())
1007 return;
1008 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1009 if (!pSectRepr)
1010 return;
1011
1019 SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE> aSet( m_rSh.GetView().GetPool() );
1020
1021 aSet.Put( pSectRepr->GetCol() );
1022 aSet.Put( *pSectRepr->GetBackground() );
1023 aSet.Put( pSectRepr->GetFootnoteNtAtEnd() );
1024 aSet.Put( pSectRepr->GetEndNtAtEnd() );
1025 aSet.Put( pSectRepr->GetBalance() );
1026 aSet.Put( *pSectRepr->GetFrameDir() );
1027 aSet.Put( *pSectRepr->GetLRSpace() );
1028
1029 const SwSectionFormats& rDocFormats = m_rSh.GetDoc()->GetSections();
1030 SwSectionFormats aOrigArray(rDocFormats);
1031
1032 SwSectionFormat* pFormat = aOrigArray[pSectRepr->GetArrPos()];
1033 tools::Long nWidth = m_rSh.GetSectionWidth(*pFormat);
1034 aOrigArray.clear();
1035 if (!nWidth)
1036 nWidth = USHRT_MAX;
1037
1038 aSet.Put(SwFormatFrameSize(SwFrameSize::Variable, nWidth));
1039 aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
1040
1041 SwSectionPropertyTabDialog aTabDlg(m_xDialog.get(), aSet, m_rSh);
1042 if (RET_OK != aTabDlg.run())
1043 return;
1044
1045 const SfxItemSet* pOutSet = aTabDlg.GetOutputItemSet();
1046 if( !(pOutSet && pOutSet->Count()) )
1047 return;
1048
1049 const SwFormatCol* pColItem = pOutSet->GetItemIfSet(
1050 RES_COL, false );
1051 const SvxBrushItem* pBrushItem = pOutSet->GetItemIfSet(
1052 RES_BACKGROUND, false );
1053 const SwFormatFootnoteAtTextEnd* pFootnoteItem = pOutSet->GetItemIfSet(
1054 RES_FTN_AT_TXTEND, false );
1055 const SwFormatEndAtTextEnd* pEndItem = pOutSet->GetItemIfSet(
1056 RES_END_AT_TXTEND, false );
1057 const SwFormatNoBalancedColumns* pBalanceItem = pOutSet->GetItemIfSet(
1058 RES_COLUMNBALANCE, false );
1059 const SvxFrameDirectionItem* pFrameDirItem = pOutSet->GetItemIfSet(
1060 RES_FRAMEDIR, false );
1061 const SvxLRSpaceItem* pLRSpaceItem = pOutSet->GetItemIfSet(
1062 RES_LR_SPACE, false );
1063
1064 if( !(pColItem ||
1065 pBrushItem ||
1066 pFootnoteItem ||
1067 pEndItem ||
1068 pBalanceItem ||
1069 pFrameDirItem ||
1070 pLRSpaceItem) )
1071 return;
1072
1073 m_xTree->selected_foreach([&](weld::TreeIter& rEntry)
1074 {
1075 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
1076 if (pColItem)
1077 pRepr->GetCol() = *pColItem;
1078 if (pBrushItem)
1079 pRepr->GetBackground().reset(pBrushItem->Clone());
1080 if (pFootnoteItem)
1081 pRepr->GetFootnoteNtAtEnd() = *pFootnoteItem;
1082 if (pEndItem)
1083 pRepr->GetEndNtAtEnd() = *pEndItem;
1084 if (pBalanceItem)
1085 pRepr->GetBalance().SetValue(pBalanceItem->GetValue());
1086 if (pFrameDirItem)
1087 pRepr->GetFrameDir()->SetValue(pFrameDirItem->GetValue());
1088 if (pLRSpaceItem)
1089 pRepr->GetLRSpace().reset(pLRSpaceItem->Clone());
1090 return false;
1091 });
1092}
1093
1094IMPL_LINK(SwEditRegionDlg, FileNameComboBoxHdl, weld::ComboBox&, rEdit, void)
1095{
1096 int nStartPos, nEndPos;
1097 rEdit.get_entry_selection_bounds(nStartPos, nEndPos);
1098 if (!CheckPasswd())
1099 return;
1100 rEdit.select_entry_region(nStartPos, nEndPos);
1101 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1102 pSectRepr->SetSubRegion( rEdit.get_active_text() );
1103}
1104
1105// Applying of the filename or the linked region
1106IMPL_LINK(SwEditRegionDlg, FileNameEntryHdl, weld::Entry&, rEdit, void)
1107{
1108 int nStartPos, nEndPos;
1109 rEdit.get_selection_bounds(nStartPos, nEndPos);
1110 if (!CheckPasswd())
1111 return;
1112 rEdit.select_region(nStartPos, nEndPos);
1113 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1114 m_xSubRegionED->clear();
1115 m_xSubRegionED->append_text(""); // put in a dummy entry, which is replaced when m_bSubRegionsFilled is set
1116 m_bSubRegionsFilled = false;
1117 if (m_xDDECB->get_active())
1118 {
1119 OUString sLink( CollapseWhiteSpaces(rEdit.get_text()) );
1120 sal_Int32 nPos = 0;
1121 sLink = sLink.replaceFirst( " ", OUStringChar(sfx2::cTokenSeparator), &nPos );
1122 if (nPos>=0)
1123 {
1124 sLink = sLink.replaceFirst( " ", OUStringChar(sfx2::cTokenSeparator), &nPos );
1125 }
1126
1127 pSectRepr->GetSectionData().SetLinkFileName( sLink );
1129 }
1130 else
1131 {
1132 OUString sTmp(rEdit.get_text());
1133 if(!sTmp.isEmpty())
1134 {
1135 SfxMedium* pMedium = m_rSh.GetView().GetDocShell()->GetMedium();
1136 INetURLObject aAbs;
1137 if( pMedium )
1138 aAbs = pMedium->GetURLObject();
1140 aAbs, sTmp, URIHelper::GetMaybeFileHdl() );
1141 }
1142 pSectRepr->SetFile( sTmp );
1143 pSectRepr->GetSectionData().SetLinkFilePassword(OUString());
1144 }
1145}
1146
1148{
1149 if (!CheckPasswd(&rButton))
1150 return;
1151 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1152 if (!pSectRepr)
1153 return;
1154
1155 bool bFile = m_xFileCB->get_active();
1156 SwSectionData & rData( pSectRepr->GetSectionData() );
1157 bool bDDE = rButton.get_active();
1158 if(bDDE)
1159 {
1160 m_xFileNameFT->hide();
1161 m_xDDECommandFT->set_sensitive(true);
1162 m_xDDECommandFT->show();
1163 m_xSubRegionFT->hide();
1164 m_xSubRegionED->hide();
1165 if (SectionType::FileLink == rData.GetType())
1166 {
1167 pSectRepr->SetFile(u"");
1168 m_xFileNameED->set_text(OUString());
1169 rData.SetLinkFilePassword(OUString());
1170 }
1172 }
1173 else
1174 {
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);
1183 if (SectionType::DdeLink == rData.GetType())
1184 {
1186 pSectRepr->SetFile(u"");
1187 rData.SetLinkFilePassword(OUString());
1188 m_xFileNameED->set_text(OUString());
1189 }
1190 }
1191 m_xFilePB->set_sensitive(bFile && !bDDE);
1192}
1193
1195{
1196 if (!CheckPasswd())
1197 {
1198 if (!bChange)
1199 m_xPasswdCB->set_active(!m_xPasswdCB->get_active());
1200 return;
1201 }
1202
1203 bool bSet = bChange ? bChange : m_xPasswdCB->get_active();
1204
1205 m_xTree->selected_foreach([this, bChange, bSet](weld::TreeIter& rEntry){
1206 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
1207 if(bSet)
1208 {
1209 if(!pRepr->GetTempPasswd().hasElements() || bChange)
1210 {
1211 SfxPasswordDialog aPasswdDlg(m_xDialog.get());
1212 aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM);
1213 if (RET_OK == aPasswdDlg.run())
1214 {
1215 const OUString sNewPasswd(aPasswdDlg.GetPassword());
1216 if (aPasswdDlg.GetConfirm() == sNewPasswd)
1217 {
1218 SvPasswordHelper::GetHashPassword( pRepr->GetTempPasswd(), sNewPasswd );
1219 }
1220 else
1221 {
1222 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
1223 VclMessageType::Info, VclButtonsType::Ok,
1224 SwResId(STR_WRONG_PASSWD_REPEAT)));
1225 xInfoBox->run();
1226 ChangePasswd(bChange);
1227 return true;
1228 }
1229 }
1230 else
1231 {
1232 if(!bChange)
1233 m_xPasswdCB->set_active(false);
1234 return true;
1235 }
1236 }
1237 pRepr->GetSectionData().SetPassword(pRepr->GetTempPasswd());
1238 }
1239 else
1240 {
1241 pRepr->GetSectionData().SetPassword(uno::Sequence<sal_Int8 >());
1242 }
1243 return false;
1244 });
1245}
1246
1248{
1249 ChangePasswd(false);
1250}
1251
1253{
1254 ChangePasswd(true);
1255}
1256
1257// the current region name is being added to the TreeListBox immediately during
1258// editing, with empty string no Ok()
1260{
1261 if(!CheckPasswd())
1262 return;
1263 std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
1264 if (m_xTree->get_selected(xIter.get()))
1265 {
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));
1270
1271 m_xOK->set_sensitive(!aName.isEmpty());
1272 }
1273}
1274
1275IMPL_LINK( SwEditRegionDlg, ConditionEditHdl, weld::Entry&, rEdit, void )
1276{
1277 int nStartPos, nEndPos;
1278 rEdit.get_selection_bounds(nStartPos, nEndPos);
1279 if(!CheckPasswd())
1280 return;
1281 rEdit.select_region(nStartPos, nEndPos);
1282
1283 m_xTree->selected_foreach([this, &rEdit](weld::TreeIter& rEntry){
1284 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
1285 pRepr->GetSectionData().SetCondition(rEdit.get_text());
1286 return false;
1287 });
1288}
1289
1290IMPL_LINK( SwEditRegionDlg, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg, void )
1291{
1292 OUString sFileName, sFilterName, sPassword;
1293 if ( _pFileDlg->GetError() == ERRCODE_NONE )
1294 {
1295 std::unique_ptr<SfxMedium> pMedium(m_pDocInserter->CreateMedium("sglobal"));
1296 if ( pMedium )
1297 {
1298 sFileName = pMedium->GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE );
1299 sFilterName = pMedium->GetFilter()->GetFilterName();
1300 if ( const SfxStringItem* pItem = pMedium->GetItemSet()->GetItemIfSet( SID_PASSWORD, false ) )
1301 sPassword = pItem->GetValue();
1302 ::lcl_ReadSections(*pMedium, *m_xSubRegionED);
1303 }
1304 }
1305
1306 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1307 if (pSectRepr)
1308 {
1309 pSectRepr->SetFile( sFileName );
1310 pSectRepr->SetFilter( sFilterName );
1311 pSectRepr->GetSectionData().SetLinkFilePassword(sPassword);
1312 m_xFileNameED->set_text(pSectRepr->GetFile());
1313 }
1314}
1315
1317{
1318 if (m_bSubRegionsFilled)
1319 return;
1320
1321 //if necessary fill the names bookmarks/sections/tables now
1322
1323 OUString sFileName = m_xFileNameED->get_text();
1324 if(!sFileName.isEmpty())
1325 {
1326 SfxMedium* pMedium = m_rSh.GetView().GetDocShell()->GetMedium();
1327 INetURLObject aAbs;
1328 if( pMedium )
1329 aAbs = pMedium->GetURLObject();
1330 sFileName = URIHelper::SmartRel2Abs(
1331 aAbs, sFileName, URIHelper::GetMaybeFileHdl() );
1332
1333 //load file and set the shell
1334 SfxMedium aMedium( sFileName, StreamMode::STD_READ );
1336 ::lcl_ReadSections(aMedium, *m_xSubRegionED);
1337 }
1338 else
1339 lcl_FillSubRegionList(m_rSh, *m_xSubRegionED, nullptr);
1340 m_bSubRegionsFilled = true;
1341}
1342
1343// helper function - read section names from medium
1344static void lcl_ReadSections( SfxMedium& rMedium, weld::ComboBox& rBox )
1345{
1346 rBox.clear();
1347 uno::Reference < embed::XStorage > xStg;
1348 if( !(rMedium.IsStorage() && (xStg = rMedium.GetStorage()).is()) )
1349 return;
1350
1351 std::vector<OUString> aArr;
1353 if ( nFormat == SotClipboardFormatId::STARWRITER_60 || nFormat == SotClipboardFormatId::STARWRITERGLOB_60 ||
1354 nFormat == SotClipboardFormatId::STARWRITER_8 || nFormat == SotClipboardFormatId::STARWRITERGLOB_8)
1355 SwGetReaderXML()->GetSectionList( rMedium, aArr );
1356
1357 for (auto const& it : aArr)
1358 {
1359 rBox.append_text(it);
1360 }
1361}
1362
1364 weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh)
1365 : SfxTabDialogController(pParent, "modules/swriter/ui/insertsectiondialog.ui",
1366 "InsertSectionDialog",&rSet)
1367 , m_rWrtSh(rSh)
1368{
1370 AddTabPage("section", SwInsertSectionTabPage::Create, nullptr);
1371 AddTabPage("columns", SwColumnPage::Create, nullptr);
1372 AddTabPage("background", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_BKG), nullptr);
1374 AddTabPage("indents", SwSectionIndentTabPage::Create, nullptr);
1375
1377
1378 bool bWeb = dynamic_cast<SwWebDocShell*>( rSh.GetView().GetDocShell() ) != nullptr ;
1379 if(bWeb)
1380 {
1381 RemoveTabPage("notes");
1382 RemoveTabPage("indents");
1383 if( HTML_CFG_NS40 != nHtmlMode && HTML_CFG_WRITER != nHtmlMode)
1384 RemoveTabPage("columns");
1385 }
1386 SetCurPageId("section");
1387}
1388
1390{
1391}
1392
1394{
1395 if (rId == "section")
1396 static_cast<SwInsertSectionTabPage&>(rPage).SetWrtShell(m_rWrtSh);
1397 else if (rId == "background")
1398 {
1399 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
1400 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_SELECTOR)));
1401 rPage.PageCreated(aSet);
1402 }
1403 else if (rId == "columns")
1404 {
1406 static_cast<SwColumnPage&>(rPage).SetPageWidth(rSize.GetWidth());
1407 static_cast<SwColumnPage&>(rPage).ShowBalance(true);
1408 static_cast<SwColumnPage&>(rPage).SetInSection(true);
1409 }
1410 else if (rId == "indents")
1411 static_cast<SwSectionIndentTabPage&>(rPage).SetWrtShell(m_rWrtSh);
1412}
1413
1415{
1416 m_pSectionData.reset( new SwSectionData(rSect) );
1417}
1418
1420{
1421 short nRet = SfxTabDialogController::Ok();
1422 OSL_ENSURE(m_pSectionData, "SwInsertSectionTabDialog: no SectionData?");
1423 const SfxItemSet* pOutputItemSet = GetOutputItemSet();
1424 m_rWrtSh.InsertSection(*m_pSectionData, pOutputItemSet);
1425 SfxViewFrame* pViewFrame = m_rWrtSh.GetView().GetViewFrame();
1426 uno::Reference< frame::XDispatchRecorder > xRecorder =
1427 pViewFrame->GetBindings().GetRecorder();
1428 if ( xRecorder.is() )
1429 {
1430 SfxRequest aRequest( pViewFrame, FN_INSERT_REGION);
1431 if(const SwFormatCol* pCol = pOutputItemSet->GetItemIfSet(RES_COL, false))
1432 {
1433 aRequest.AppendItem(SfxUInt16Item(SID_ATTR_COLUMNS,
1434 pCol->GetColumns().size()));
1435 }
1437 m_pSectionData->GetSectionName()));
1439 m_pSectionData->GetCondition()));
1441 m_pSectionData->IsHidden()));
1443 m_pSectionData->IsProtectFlag()));
1444 // edit in readonly sections
1446 m_pSectionData->IsEditInReadonlyFlag()));
1447
1448 const OUString sLinkFileName( m_pSectionData->GetLinkFileName() );
1449 sal_Int32 n = 0;
1450 aRequest.AppendItem(SfxStringItem( FN_PARAM_1, sLinkFileName.getToken( 0, sfx2::cTokenSeparator, n )));
1451 aRequest.AppendItem(SfxStringItem( FN_PARAM_2, sLinkFileName.getToken( 0, sfx2::cTokenSeparator, n )));
1452 aRequest.AppendItem(SfxStringItem( FN_PARAM_3, sLinkFileName.getToken( 0, sfx2::cTokenSeparator, n )));
1453 aRequest.Done();
1454 }
1455 return nRet;
1456}
1457
1459 : SfxTabPage(pPage, pController, "modules/swriter/ui/sectionpage.ui", "SectionPage", &rAttrSet)
1460 , m_pWrtSh(nullptr)
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")))
1477 // edit in readonly sections
1478 , m_xEditInReadonlyCB(m_xBuilder->weld_check_button("editable"))
1479{
1480 m_xCurName->make_sorted();
1481 m_xCurName->set_height_request_by_rows(12);
1482 m_xSubRegionED->make_sorted();
1483
1484 m_xProtectCB->connect_toggled( LINK( this, SwInsertSectionTabPage, ChangeProtectHdl));
1485 m_xPasswdCB->connect_toggled( LINK( this, SwInsertSectionTabPage, TogglePasswdHdl));
1486 m_xPasswdPB->connect_clicked( LINK( this, SwInsertSectionTabPage, ChangePasswdHdl));
1487 m_xHideCB->connect_toggled( LINK( this, SwInsertSectionTabPage, ChangeHideHdl));
1488 m_xFileCB->connect_toggled( LINK( this, SwInsertSectionTabPage, UseFileHdl ));
1489 m_xFilePB->connect_clicked( LINK( this, SwInsertSectionTabPage, FileSearchHdl ));
1490 m_xCurName->connect_changed( LINK( this, SwInsertSectionTabPage, NameEditHdl));
1491 m_xDDECB->connect_toggled( LINK( this, SwInsertSectionTabPage, DDEHdl ));
1492 ChangeProtectHdl(*m_xProtectCB);
1493 m_xSubRegionED->set_entry_completion(true, true);
1494}
1495
1497{
1498}
1499
1501{
1502 m_pWrtSh = &rSh;
1503
1504 bool bWeb = dynamic_cast<SwWebDocShell*>( m_pWrtSh->GetView().GetDocShell() )!= nullptr;
1505 if(bWeb)
1506 {
1507 m_xHideCB->hide();
1508 m_xConditionED->hide();
1509 m_xConditionFT->hide();
1510 m_xDDECB->hide();
1511 m_xDDECommandFT->hide();
1512 }
1513
1515
1516 SwSectionData *const pSectionData =
1518 ->GetSectionData();
1519 if (pSectionData) // something set?
1520 {
1521 const OUString sSectionName(pSectionData->GetSectionName());
1522 m_xCurName->set_entry_text(rSh.GetUniqueSectionName(&sSectionName));
1523 m_xProtectCB->set_active( pSectionData->IsProtectFlag() );
1524 ChangeProtectHdl(*m_xProtectCB);
1525 m_sFileName = pSectionData->GetLinkFileName();
1526 m_sFilePasswd = pSectionData->GetLinkFilePassword();
1527 m_xFileCB->set_active( !m_sFileName.isEmpty() );
1528 m_xFileNameED->set_text( m_sFileName );
1529 UseFileHdl(*m_xFileCB);
1530 }
1531 else
1532 {
1533 m_xCurName->set_entry_text(rSh.GetUniqueSectionName());
1534 }
1535}
1536
1538{
1539 SwSectionData aSection(SectionType::Content, m_xCurName->get_active_text());
1540 aSection.SetCondition(m_xConditionED->get_text());
1541 bool bProtected = m_xProtectCB->get_active();
1542 aSection.SetProtectFlag(bProtected);
1543 aSection.SetHidden(m_xHideCB->get_active());
1544 // edit in readonly sections
1545 aSection.SetEditInReadonlyFlag(m_xEditInReadonlyCB->get_active());
1546
1547 if(bProtected)
1548 {
1549 aSection.SetPassword(m_aNewPasswd);
1550 }
1551 const OUString sFileName = m_xFileNameED->get_text();
1552 const OUString sSubRegion = m_xSubRegionED->get_active_text();
1553 bool bDDe = m_xDDECB->get_active();
1554 if (m_xFileCB->get_active() && (!sFileName.isEmpty() || !sSubRegion.isEmpty() || bDDe))
1555 {
1556 OUString aLinkFile;
1557 if( bDDe )
1558 {
1559 aLinkFile = CollapseWhiteSpaces(sFileName);
1560 sal_Int32 nPos = 0;
1561 aLinkFile = aLinkFile.replaceFirst( " ", OUStringChar(sfx2::cTokenSeparator), &nPos );
1562 if (nPos>=0)
1563 {
1564 aLinkFile = aLinkFile.replaceFirst( " ", OUStringChar(sfx2::cTokenSeparator), &nPos );
1565 }
1566 }
1567 else
1568 {
1569 if(!sFileName.isEmpty())
1570 {
1571 SfxMedium* pMedium = m_pWrtSh->GetView().GetDocShell()->GetMedium();
1572 INetURLObject aAbs;
1573 if( pMedium )
1574 aAbs = pMedium->GetURLObject();
1575 aLinkFile = URIHelper::SmartRel2Abs(
1576 aAbs, sFileName, URIHelper::GetMaybeFileHdl() );
1578 }
1579
1580 aLinkFile += OUStringChar(sfx2::cTokenSeparator) + m_sFilterName
1581 + OUStringChar(sfx2::cTokenSeparator) + sSubRegion;
1582 }
1583
1584 aSection.SetLinkFileName(aLinkFile);
1585 if (!aLinkFile.isEmpty())
1586 {
1587 aSection.SetType( m_xDDECB->get_active() ?
1590 }
1591 }
1592 static_cast<SwInsertSectionTabDialog*>(GetDialogController())->SetSectionData(aSection);
1593 return true;
1594}
1595
1597{
1598}
1599
1600std::unique_ptr<SfxTabPage> SwInsertSectionTabPage::Create(weld::Container* pPage, weld::DialogController* pController,
1601 const SfxItemSet* rAttrSet)
1602{
1603 return std::make_unique<SwInsertSectionTabPage>(pPage, pController, *rAttrSet);
1604}
1605
1607{
1608 bool bHide = rBox.get_active();
1609 m_xConditionED->set_sensitive(bHide);
1610 m_xConditionFT->set_sensitive(bHide);
1611}
1612
1613IMPL_LINK(SwInsertSectionTabPage, ChangeProtectHdl, weld::Toggleable&, rBox, void)
1614{
1615 bool bCheck = rBox.get_active();
1616 m_xPasswdCB->set_sensitive(bCheck);
1617 m_xPasswdPB->set_sensitive(bCheck);
1618}
1619
1621{
1622 bool bSet = bChange ? bChange : m_xPasswdCB->get_active();
1623 if (bSet)
1624 {
1625 if(!m_aNewPasswd.hasElements() || bChange)
1626 {
1627 SfxPasswordDialog aPasswdDlg(GetFrameWeld());
1628 aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM);
1629 if (RET_OK == aPasswdDlg.run())
1630 {
1631 const OUString sNewPasswd(aPasswdDlg.GetPassword());
1632 if (aPasswdDlg.GetConfirm() == sNewPasswd)
1633 {
1635 }
1636 else
1637 {
1638 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
1639 VclMessageType::Info, VclButtonsType::Ok,
1640 SwResId(STR_WRONG_PASSWD_REPEAT)));
1641 xInfoBox->run();
1642 }
1643 }
1644 else if(!bChange)
1645 m_xPasswdCB->set_active(false);
1646 }
1647 }
1648 else
1649 m_aNewPasswd.realloc(0);
1650}
1651
1653{
1654 ChangePasswd(false);
1655}
1656
1658{
1659 ChangePasswd(true);
1660}
1661
1662
1664{
1665 const OUString aName = m_xCurName->get_active_text();
1666 GetDialogController()->GetOKButton().set_sensitive(!aName.isEmpty() &&
1667 m_xCurName->find_text(aName) == -1);
1668}
1669
1671{
1672 if (rButton.get_active())
1673 {
1674 if (m_pWrtSh->HasSelection())
1675 {
1676 std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
1677 VclMessageType::Question, VclButtonsType::YesNo,
1678 SwResId(STR_QUERY_CONNECT)));
1679 if (RET_NO == xQueryBox->run())
1680 rButton.set_active(false);
1681 }
1682 }
1683
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);
1692 if (bFile)
1693 {
1694 m_xFileNameED->grab_focus();
1695 m_xProtectCB->set_active(true);
1696 ChangeProtectHdl(*m_xProtectCB);
1697 }
1698 else
1699 {
1700 m_xDDECB->set_active(false);
1701 DDEHdl(*m_xDDECB);
1702 }
1703}
1704
1706{
1707 m_pDocInserter.reset(new ::sfx2::DocumentInserter(GetFrameWeld(), "swriter"));
1708 m_pDocInserter->StartExecuteModal( LINK( this, SwInsertSectionTabPage, DlgClosedHdl ) );
1709}
1710
1712{
1713 bool bDDE = rButton.get_active();
1714 bool bFile = m_xFileCB->get_active();
1715 m_xFilePB->set_sensitive(!bDDE && bFile);
1716 if (bDDE)
1717 {
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());
1724 }
1725 else
1726 {
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());
1734 }
1735}
1736
1737IMPL_LINK( SwInsertSectionTabPage, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg, void )
1738{
1739 if ( _pFileDlg->GetError() == ERRCODE_NONE )
1740 {
1741 std::unique_ptr<SfxMedium> pMedium(m_pDocInserter->CreateMedium("sglobal"));
1742 if ( pMedium )
1743 {
1744 m_sFileName = pMedium->GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE );
1745 m_sFilterName = pMedium->GetFilter()->GetFilterName();
1746 if ( const SfxStringItem* pItem = pMedium->GetItemSet()->GetItemIfSet( SID_PASSWORD, false ) )
1747 m_sFilePasswd = pItem->GetValue();
1748 m_xFileNameED->set_text( INetURLObject::decode(
1750 ::lcl_ReadSections(*pMedium, *m_xSubRegionED);
1751 }
1752 }
1753 else
1754 {
1755 m_sFilterName.clear();
1756 m_sFilePasswd.clear();
1757 }
1758}
1759
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"))
1769 , m_xFootnoteNumViewBox(new SwNumberingTypeListBox(m_xBuilder->weld_combo_box("ftnnumviewbox")))
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"))
1779 , m_xEndNumViewBox(new SwNumberingTypeListBox(m_xBuilder->weld_combo_box("endnumviewbox")))
1780 , m_xEndSuffixFT(m_xBuilder->weld_label("endsuffix_label"))
1781 , m_xEndSuffixED(m_xBuilder->weld_entry("endsuffix"))
1782{
1785
1787 m_xFootnoteNtAtTextEndCB->connect_toggled( aLk );
1788 m_xFootnoteNtNumCB->connect_toggled( aLk );
1789 m_xEndNtAtTextEndCB->connect_toggled( aLk );
1790 m_xEndNtNumCB->connect_toggled( aLk );
1791 m_xFootnoteNtNumFormatCB->connect_toggled( aLk );
1792 m_xEndNtNumFormatCB->connect_toggled( aLk );
1793}
1794
1796{
1797}
1798
1800{
1802 ? ( m_xFootnoteNtNumCB->get_active()
1803 ? ( m_xFootnoteNtNumFormatCB->get_active()
1806 : FTNEND_ATTXTEND )
1808
1809 switch( aFootnote.GetValue() )
1810 {
1812 aFootnote.SetNumType( m_xFootnoteNumViewBox->GetSelectedNumberingType() );
1813 aFootnote.SetPrefix( m_xFootnotePrefixED->get_text().replaceAll("\\t", "\t") ); // fdo#65666
1814 aFootnote.SetSuffix( m_xFootnoteSuffixED->get_text().replaceAll("\\t", "\t") );
1815 [[fallthrough]];
1816
1818 aFootnote.SetOffset( static_cast< sal_uInt16 >( m_xFootnoteOffsetField->get_value()-1 ) );
1819 break;
1820 default: break;
1821 }
1822
1823 SwFormatEndAtTextEnd aEnd( m_xEndNtAtTextEndCB->get_active()
1824 ? ( m_xEndNtNumCB->get_active()
1825 ? ( m_xEndNtNumFormatCB->get_active()
1828 : FTNEND_ATTXTEND )
1830
1831 switch( aEnd.GetValue() )
1832 {
1834 aEnd.SetNumType( m_xEndNumViewBox->GetSelectedNumberingType() );
1835 aEnd.SetPrefix( m_xEndPrefixED->get_text().replaceAll("\\t", "\t") );
1836 aEnd.SetSuffix( m_xEndSuffixED->get_text().replaceAll("\\t", "\t") );
1837 [[fallthrough]];
1838
1840 aEnd.SetOffset( static_cast< sal_uInt16 >( m_xEndOffsetField->get_value()-1 ) );
1841 break;
1842 default: break;
1843 }
1844
1845 rSet->Put( aFootnote );
1846 rSet->Put( aEnd );
1847
1848 return true;
1849}
1850
1852 const SwFormatFootnoteEndAtTextEnd& rAttr )
1853{
1854 weld::CheckButton *pNtAtTextEndCB, *pNtNumCB, *pNtNumFormatCB;
1855 weld::Label *pPrefixFT, *pSuffixFT;
1856 weld::Entry *pPrefixED, *pSuffixED;
1857 SwNumberingTypeListBox *pNumViewBox;
1858 weld::Label *pOffsetText;
1859 weld::SpinButton *pOffsetField;
1860
1861 if( bFootnote )
1862 {
1863 pNtAtTextEndCB = m_xFootnoteNtAtTextEndCB.get();
1864 pNtNumCB = m_xFootnoteNtNumCB.get();
1865 pNtNumFormatCB = m_xFootnoteNtNumFormatCB.get();
1866 pPrefixFT = m_xFootnotePrefixFT.get();
1867 pPrefixED = m_xFootnotePrefixED.get();
1868 pSuffixFT = m_xFootnoteSuffixFT.get();
1869 pSuffixED = m_xFootnoteSuffixED.get();
1870 pNumViewBox = m_xFootnoteNumViewBox.get();
1871 pOffsetText = m_xFootnoteOffsetLbl.get();
1872 pOffsetField = m_xFootnoteOffsetField.get();
1873 }
1874 else
1875 {
1876 pNtAtTextEndCB = m_xEndNtAtTextEndCB.get();
1877 pNtNumCB = m_xEndNtNumCB.get();
1878 pNtNumFormatCB = m_xEndNtNumFormatCB.get();
1879 pPrefixFT = m_xEndPrefixFT.get();
1880 pPrefixED = m_xEndPrefixED.get();
1881 pSuffixFT = m_xEndSuffixFT.get();
1882 pSuffixED = m_xEndSuffixED.get();
1883 pNumViewBox = m_xEndNumViewBox.get();
1884 pOffsetText = m_xEndOffsetLbl.get();
1885 pOffsetField = m_xEndOffsetField.get();
1886 }
1887
1888 const sal_uInt16 eState = rAttr.GetValue();
1889 switch( eState )
1890 {
1892 pNtNumFormatCB->set_state( TRISTATE_TRUE );
1893 [[fallthrough]];
1894
1896 pNtNumCB->set_state( TRISTATE_TRUE );
1897 [[fallthrough]];
1898
1899 case FTNEND_ATTXTEND:
1900 pNtAtTextEndCB->set_state( TRISTATE_TRUE );
1901 // no break;
1902 }
1903
1904 pNumViewBox->SelectNumberingType( rAttr.GetNumType() );
1905 pOffsetField->set_value( rAttr.GetOffset() + 1 );
1906 pPrefixED->set_text( rAttr.GetPrefix().replaceAll("\t", "\\t") );
1907 pSuffixED->set_text( rAttr.GetSuffix().replaceAll("\t", "\\t") );
1908
1909 switch( eState )
1910 {
1912 pNtNumCB->set_sensitive( false );
1913 [[fallthrough]];
1914
1915 case FTNEND_ATTXTEND:
1916 pNtNumFormatCB->set_sensitive( false );
1917 pOffsetField->set_sensitive( false );
1918 pOffsetText->set_sensitive( false );
1919 [[fallthrough]];
1920
1922 pNumViewBox->set_sensitive( false );
1923 pPrefixFT->set_sensitive( false );
1924 pPrefixED->set_sensitive( false );
1925 pSuffixFT->set_sensitive( false );
1926 pSuffixED->set_sensitive( false );
1927 // no break;
1928 }
1929}
1930
1932{
1933 ResetState( true, rSet->Get( RES_FTN_AT_TXTEND, false ));
1934 ResetState( false, rSet->Get( RES_END_AT_TXTEND, false ));
1935}
1936
1937std::unique_ptr<SfxTabPage> SwSectionFootnoteEndTabPage::Create( weld::Container* pPage, weld::DialogController* pController,
1938 const SfxItemSet* rAttrSet)
1939{
1940 return std::make_unique<SwSectionFootnoteEndTabPage>(pPage, pController, *rAttrSet);
1941}
1942
1944{
1945 bool bFoot = m_xFootnoteNtAtTextEndCB.get() == &rBox || m_xFootnoteNtNumCB.get() == &rBox ||
1946 m_xFootnoteNtNumFormatCB.get() == &rBox ;
1947
1948 weld::CheckButton *pNumBox, *pNumFormatBox, *pEndBox;
1949 SwNumberingTypeListBox* pNumViewBox;
1950 weld::Label *pOffsetText;
1951 weld::SpinButton *pOffsetField;
1952 weld::Label *pPrefixFT, *pSuffixFT;
1953 weld::Entry *pPrefixED, *pSuffixED;
1954
1955 if( bFoot )
1956 {
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();
1967 }
1968 else
1969 {
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();
1980 }
1981
1982 bool bEnableAtEnd = TRISTATE_TRUE == pEndBox->get_state();
1983 bool bEnableNum = bEnableAtEnd && TRISTATE_TRUE == pNumBox->get_state();
1984 bool bEnableNumFormat = bEnableNum && TRISTATE_TRUE == pNumFormatBox->get_state();
1985
1986 pNumBox->set_sensitive( bEnableAtEnd );
1987 pOffsetText->set_sensitive( bEnableNum );
1988 pOffsetField->set_sensitive( bEnableNum );
1989 pNumFormatBox->set_sensitive( bEnableNum );
1990 pNumViewBox->set_sensitive( bEnableNumFormat );
1991 pPrefixED->set_sensitive( bEnableNumFormat );
1992 pSuffixED->set_sensitive( bEnableNumFormat );
1993 pPrefixFT->set_sensitive( bEnableNumFormat );
1994 pSuffixFT->set_sensitive( bEnableNumFormat );
1995}
1996
1998 weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh)
1999 : SfxTabDialogController(pParent, "modules/swriter/ui/formatsectiondialog.ui",
2000 "FormatSectionDialog", &rSet)
2001 , m_rWrtSh(rSh)
2002{
2004 AddTabPage("columns", SwColumnPage::Create, nullptr);
2005 AddTabPage("background", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_BKG), nullptr);
2007 AddTabPage("indents", SwSectionIndentTabPage::Create, nullptr);
2008
2010 bool bWeb = dynamic_cast<SwWebDocShell*>( rSh.GetView().GetDocShell() ) != nullptr ;
2011 if(bWeb)
2012 {
2013 RemoveTabPage("notes");
2014 RemoveTabPage("indents");
2015 if( HTML_CFG_NS40 != nHtmlMode && HTML_CFG_WRITER != nHtmlMode)
2016 RemoveTabPage("columns");
2017 }
2018}
2019
2021{
2022}
2023
2025{
2026 if (rId == "background")
2027 {
2028 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
2029 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_SELECTOR)));
2030 rPage.PageCreated(aSet);
2031 }
2032 else if (rId == "columns")
2033 {
2034 static_cast<SwColumnPage&>(rPage).ShowBalance(true);
2035 static_cast<SwColumnPage&>(rPage).SetInSection(true);
2036 }
2037 else if (rId == "indents")
2038 static_cast<SwSectionIndentTabPage&>(rPage).SetWrtShell(m_rWrtSh);
2039}
2040
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))
2046{
2048 m_xBeforeMF->connect_value_changed(aLk);
2049 m_xAfterMF->connect_value_changed(aLk);
2050}
2051
2053{
2054}
2055
2057{
2058 if (m_xBeforeMF->get_value_changed_from_saved() || m_xAfterMF->get_value_changed_from_saved())
2059 {
2060 SvxLRSpaceItem aLRSpace(
2061 m_xBeforeMF->denormalize(m_xBeforeMF->get_value(FieldUnit::TWIP)) ,
2062 m_xAfterMF->denormalize(m_xAfterMF->get_value(FieldUnit::TWIP)), 0, 0, RES_LR_SPACE);
2063 rSet->Put(aLRSpace);
2064 }
2065 return true;
2066}
2067
2069{
2070 //this page doesn't show up in HTML mode
2071 FieldUnit aMetric = ::GetDfltMetric(false);
2072 SetFieldUnit(*m_xBeforeMF, aMetric);
2073 SetFieldUnit(*m_xAfterMF , aMetric);
2074
2075 SfxItemState eItemState = rSet->GetItemState( RES_LR_SPACE );
2076 if ( eItemState >= SfxItemState::DEFAULT )
2077 {
2078 const SvxLRSpaceItem& rSpace =
2079 rSet->Get( RES_LR_SPACE );
2080
2081 m_xBeforeMF->set_value(m_xBeforeMF->normalize(rSpace.GetLeft()), FieldUnit::TWIP);
2082 m_xAfterMF->set_value(m_xAfterMF->normalize(rSpace.GetRight()), FieldUnit::TWIP);
2083 }
2084 else
2085 {
2086 m_xBeforeMF->set_text("");
2087 m_xAfterMF->set_text("");
2088 }
2089 m_xBeforeMF->save_value();
2090 m_xAfterMF->save_value();
2091 IndentModifyHdl(*m_xBeforeMF);
2092}
2093
2094std::unique_ptr<SfxTabPage> SwSectionIndentTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet)
2095{
2096 return std::make_unique<SwSectionIndentTabPage>(pPage, pController, *rAttrSet);
2097}
2098
2100{
2101 //set sensible values at the preview
2102 m_aPreviewWin.SetAdjust(SvxAdjust::Block);
2103 m_aPreviewWin.SetLastLine(SvxAdjust::Block);
2104 const SwRect& rPageRect = rSh.GetAnyCurRect( CurRectType::Page );
2105 Size aPageSize(rPageRect.Width(), rPageRect.Height());
2106 m_aPreviewWin.SetSize(aPageSize);
2107}
2108
2110{
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();
2114}
2115
2116/* 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, bool bMobile=false)
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:165
bool m_bSelected
Definition: uiregionsw.cxx:175
SwFormatCol m_Col
Definition: uiregionsw.cxx:164
SwSectionData & GetSectionData()
Definition: uiregionsw.cxx:181
SwFormatFootnoteAtTextEnd & GetFootnoteNtAtEnd()
Definition: uiregionsw.cxx:184
bool m_bContent
Definition: uiregionsw.cxx:173
SwFormatCol & GetCol()
Definition: uiregionsw.cxx:182
SwFormatNoBalancedColumns & GetBalance()
Definition: uiregionsw.cxx:186
void SetTempPasswd(const uno::Sequence< sal_Int8 > &rPasswd)
Definition: uiregionsw.cxx:204
void SetFilter(std::u16string_view rFilter)
Definition: uiregionsw.cxx:258
SwFormatNoBalancedColumns m_Balance
Definition: uiregionsw.cxx:168
bool IsContent() const
Definition: uiregionsw.cxx:197
void SetSelected()
Definition: uiregionsw.cxx:200
const size_t m_nArrPos
Definition: uiregionsw.cxx:171
SwFormatFootnoteAtTextEnd m_FootnoteNtAtEnd
Definition: uiregionsw.cxx:166
uno::Sequence< sal_Int8 > & GetTempPasswd()
Definition: uiregionsw.cxx:203
OUString GetSubRegion() const
Definition: uiregionsw.cxx:322
SwFormatEndAtTextEnd & GetEndNtAtEnd()
Definition: uiregionsw.cxx:185
std::shared_ptr< SvxFrameDirectionItem > m_FrameDirItem
Definition: uiregionsw.cxx:169
SwFormatEndAtTextEnd m_EndNtAtEnd
Definition: uiregionsw.cxx:167
void SetContent(bool const bValue)
Definition: uiregionsw.cxx:198
std::shared_ptr< SvxLRSpaceItem > & GetLRSpace()
Definition: uiregionsw.cxx:188
OUString GetFile() const
Definition: uiregionsw.cxx:304
SectRepr(size_t nPos, SwSection &rSect)
Definition: uiregionsw.cxx:208
std::shared_ptr< SvxLRSpaceItem > m_LRSpaceItem
Definition: uiregionsw.cxx:170
bool IsSelected() const
Definition: uiregionsw.cxx:201
SwSectionData m_SectionData
Definition: uiregionsw.cxx:163
std::shared_ptr< SvxFrameDirectionItem > & GetFrameDir()
Definition: uiregionsw.cxx:187
uno::Sequence< sal_Int8 > m_TempPasswd
Definition: uiregionsw.cxx:176
void SetFile(std::u16string_view rFile)
Definition: uiregionsw.cxx:230
std::unique_ptr< SvxBrushItem > & GetBackground()
Definition: uiregionsw.cxx:183
void SetSubRegion(std::u16string_view rSubRegion)
Definition: uiregionsw.cxx:280
size_t GetArrPos() const
Definition: uiregionsw.cxx:190
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 OString &rName)
void AddTabPage(const OString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
virtual short run() override
const SfxItemSet * GetOutputItemSet() const
void RemoveTabPage(const OString &rName)
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:546
std::unique_ptr< weld::CheckButton > m_xFileCB
Definition: regionsw.hxx:59
SwEditRegionDlg(weld::Window *pParent, SwWrtShell &rWrtSh)
Definition: uiregionsw.cxx:331
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:465
SwWrtShell & m_rSh
Definition: regionsw.hxx:50
size_t FindArrPos(const SwSectionFormat *pFormat)
Definition: uiregionsw.cxx:535
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::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:419
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:558
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:94
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:74
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:161
virtual short Ok() override
void SetSectionData(SwSectionData const &rSect)
virtual void PageCreated(const OString &rId, SfxTabPage &rPage) override
SwInsertSectionTabDialog(weld::Window *pParent, const SfxItemSet &rSet, SwWrtShell &rSh)
virtual ~SwInsertSectionTabDialog() override
std::unique_ptr< SwSectionData > m_pSectionData
Definition: regionsw.hxx:231
SwWrtShell * m_pWrtSh
Definition: regionsw.hxx:125
std::unique_ptr< weld::Button > m_xPasswdPB
Definition: regionsw.hxx:139
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:638
SwSectionFormat * GetParent() const
Definition: section.hxx:356
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:192
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
SwSectionPropertyTabDialog(weld::Window *pParent, const SfxItemSet &rSet, SwWrtShell &rSh)
virtual void PageCreated(const OString &rId, SfxTabPage &rPage) override
bool IsHidden() const
Definition: section.hxx:179
const OUString & GetSectionName() const
Definition: section.hxx:169
SwSectionFormat * GetFormat()
Definition: section.hxx:337
bool IsProtect() const
Definition: section.cxx:326
SectionType GetType() const
Definition: section.hxx:171
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: viewsh.cxx:2807
SwDocShell * GetDocShell()
Definition: view.cxx:1160
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
const SwView & GetView() const
Definition: wrtsh.hxx:438
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:294
#define FN_PARAM_REGION_PROTECT
Definition: cmdid.h:794
#define FN_PARAM_REGION_NAME
Definition: cmdid.h:791
#define FN_PARAM_REGION_CONDITION
Definition: cmdid.h:792
#define FN_PARAM_REGION_EDIT_IN_READONLY
Definition: cmdid.h:795
#define FN_PARAM_REGION_HIDDEN
Definition: cmdid.h:793
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
SvxFrameDirection
TRISTATE_FALSE
TRISTATE_INDET
TRISTATE_TRUE
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
constexpr TypedWhichId< SwFormatNoBalancedColumns > RES_COLUMNBALANCE(119)
constexpr TypedWhichId< SwFormatCol > RES_COL(109)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SwFormatEndAtTextEnd > RES_END_AT_TXTEND(118)
constexpr TypedWhichId< SwFormatFootnoteAtTextEnd > RES_FTN_AT_TXTEND(117)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
#define HTML_CFG_NS40
#define HTML_CFG_WRITER
static bool bFootnote
Definition: insfnote.cxx:33
OUString aName
sal_Int64 n
sal_uInt16 nPos
aBuf
const char * sName
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:165
sal_uInt16 sal_Unicode
IMPL_LINK(SwEditRegionDlg, GetFirstEntryHdl, weld::TreeView &, rBox, void)
Definition: uiregionsw.cxx:580
static void lcl_FillSubRegionList(SwWrtShell &rSh, weld::ComboBox &rSubRegions, weld::ComboBox *pAvailNames)
Definition: uiregionsw.cxx:144
static void lcl_ReadSections(SfxMedium &rMedium, weld::ComboBox &rBox)
IMPL_LINK_NOARG(SwEditRegionDlg, OkHdl, weld::Button &, void)
Definition: uiregionsw.cxx:741
static void lcl_FillList(SwWrtShell &rSh, weld::ComboBox &rSubRegions, weld::ComboBox *pAvailNames, const SwSectionFormat *pNewFormat)
Definition: uiregionsw.cxx:97
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:755
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)