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}
419
421{
423 return true;
424 bool bRet = true;
425
426 m_xTree->selected_foreach([this, &bRet](weld::TreeIter& rEntry){
427 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
428 if (!pRepr->GetTempPasswd().hasElements()
429 && pRepr->GetSectionData().GetPassword().hasElements())
430 {
431 SfxPasswordDialog aPasswdDlg(m_xDialog.get());
432 bRet = false;
433 if (aPasswdDlg.run())
434 {
435 const OUString sNewPasswd(aPasswdDlg.GetPassword());
436 css::uno::Sequence <sal_Int8 > aNewPasswd;
437 SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
439 pRepr->GetSectionData().GetPassword(), sNewPasswd))
440 {
441 pRepr->SetTempPasswd(aNewPasswd);
442 bRet = true;
443 }
444 else
445 {
446 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
447 VclMessageType::Info, VclButtonsType::Ok,
448 SwResId(STR_WRONG_PASSWORD)));
449 xInfoBox->run();
450 }
451 }
452 }
453 return false;
454 });
455 if (!bRet && pBox)
456 {
457 //reset old button state
458 if (pBox->get_state() != TRISTATE_INDET)
459 pBox->set_active(!pBox->get_active());
460 }
461
462 return bRet;
463}
464
465// recursively look for child-sections
467{
468 std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
469 if (!pFormat)
470 {
471 const size_t nCount=m_rSh.GetSectionFormatCount();
472 for ( size_t n = 0; n < nCount; n++ )
473 {
474 SectionType eTmpType;
475 if( !( pFormat = &m_rSh.GetSectionFormat(n))->GetParent() &&
476 pFormat->IsInNodesArr() &&
477 (eTmpType = pFormat->GetSection()->GetType()) != SectionType::ToxContent
478 && SectionType::ToxHeader != eTmpType )
479 {
480 SwSection *pSect = pFormat->GetSection();
481 SectRepr* pSectRepr = new SectRepr( n, *pSect );
482
483 OUString sText(pSect->GetSectionName());
484 OUString sImage(BuildBitmap(pSect->IsProtect(),pSect->IsHidden()));
485 OUString sId(weld::toId(pSectRepr));
486 m_xTree->insert(nullptr, -1, &sText, &sId, nullptr, nullptr, false, xIter.get());
487 m_xTree->set_image(*xIter, sImage);
488
489 RecurseList(pFormat, xIter.get());
490 if (m_xTree->iter_has_child(*xIter))
491 m_xTree->expand_row(*xIter);
492 if (m_pCurrSect==pSect)
493 {
494 m_xTree->select(*xIter);
495 m_xTree->scroll_to_row(*xIter);
496 GetFirstEntryHdl(*m_xTree);
497 }
498 }
499 }
500 }
501 else
502 {
503 SwSections aTmpArr;
504 pFormat->GetChildSections(aTmpArr, SectionSort::Pos);
505 for( const auto pSect : aTmpArr )
506 {
507 SectionType eTmpType;
508 pFormat = pSect->GetFormat();
509 if( pFormat->IsInNodesArr() &&
510 (eTmpType = pFormat->GetSection()->GetType()) != SectionType::ToxContent
511 && SectionType::ToxHeader != eTmpType )
512 {
513 SectRepr* pSectRepr=new SectRepr(
514 FindArrPos( pSect->GetFormat() ), *pSect );
515
516 OUString sText(pSect->GetSectionName());
517 OUString sImage = BuildBitmap(pSect->IsProtect(), pSect->IsHidden());
518 OUString sId(weld::toId(pSectRepr));
519 m_xTree->insert(pEntry, -1, &sText, &sId, nullptr, nullptr, false, xIter.get());
520 m_xTree->set_image(*xIter, sImage);
521
522 RecurseList(pSect->GetFormat(), xIter.get());
523 if (m_xTree->iter_has_child(*xIter))
524 m_xTree->expand_row(*xIter);
525 if (m_pCurrSect==pSect)
526 {
527 m_xTree->select(*xIter);
528 m_xTree->scroll_to_row(*xIter);
529 GetFirstEntryHdl(*m_xTree);
530 }
531 }
532 }
533 }
534}
535
537{
538 const size_t nCount=m_rSh.GetSectionFormatCount();
539 for ( size_t i = 0; i < nCount; i++ )
540 if ( pFormat == &m_rSh.GetSectionFormat(i) )
541 return i;
542
543 OSL_FAIL("SectionFormat not on the list" );
544 return SIZE_MAX;
545}
546
548{
549 std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
550 if (m_xTree->get_iter_first(*xIter))
551 {
552 do
553 {
554 delete weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
555 } while (m_xTree->iter_next(*xIter));
556 }
557}
558
559void SwEditRegionDlg::SelectSection(std::u16string_view rSectionName)
560{
561 std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
562 if (!m_xTree->get_iter_first(*xIter))
563 return;
564
565 do
566 {
567 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
568 if (pRepr->GetSectionData().GetSectionName() == rSectionName)
569 {
570 m_xTree->unselect_all();
571 m_xTree->select(*xIter);
572 m_xTree->scroll_to_row(*xIter);
573 GetFirstEntryHdl(*m_xTree);
574 break;
575 }
576 } while (m_xTree->iter_next(*xIter));
577}
578
579// selected entry in TreeListBox is showed in Edit window in case of
580// multiselection some controls are disabled
581IMPL_LINK(SwEditRegionDlg, GetFirstEntryHdl, weld::TreeView&, rBox, void)
582{
583 m_bDontCheckPasswd = true;
584 std::unique_ptr<weld::TreeIter> xIter(rBox.make_iterator());
585 bool bEntry = rBox.get_selected(xIter.get());
586 m_xHideCB->set_sensitive(true);
587 // edit in readonly sections
588 m_xEditInReadonlyCB->set_sensitive(true);
589
590 m_xProtectCB->set_sensitive(true);
591 m_xFileCB->set_sensitive(true);
592 css::uno::Sequence <sal_Int8> aCurPasswd;
593 if (1 < rBox.count_selected_rows())
594 {
595 m_xHideCB->set_state(TRISTATE_INDET);
596 m_xProtectCB->set_state(TRISTATE_INDET);
597 // edit in readonly sections
598 m_xEditInReadonlyCB->set_state(TRISTATE_INDET);
599 m_xFileCB->set_state(TRISTATE_INDET);
600
601 bool bHiddenValid = true;
602 bool bProtectValid = true;
603 bool bConditionValid = true;
604 // edit in readonly sections
605 bool bEditInReadonlyValid = true;
606 bool bEditInReadonly = true;
607
608 bool bHidden = true;
609 bool bProtect = true;
610 OUString sCondition;
611 bool bFirst = true;
612 bool bFileValid = true;
613 bool bFile = true;
614 bool bPasswdValid = true;
615
616 m_xTree->selected_foreach([&](weld::TreeIter& rEntry){
617 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
618 SwSectionData const& rData( pRepr->GetSectionData() );
619 if(bFirst)
620 {
621 sCondition = rData.GetCondition();
622 bHidden = rData.IsHidden();
623 bProtect = rData.IsProtectFlag();
624 // edit in readonly sections
625 bEditInReadonly = rData.IsEditInReadonlyFlag();
626
627 bFile = (rData.GetType() != SectionType::Content);
628 aCurPasswd = rData.GetPassword();
629 }
630 else
631 {
632 if(sCondition != rData.GetCondition())
633 bConditionValid = false;
634 bHiddenValid = (bHidden == rData.IsHidden());
635 bProtectValid = (bProtect == rData.IsProtectFlag());
636 // edit in readonly sections
637 bEditInReadonlyValid =
638 (bEditInReadonly == rData.IsEditInReadonlyFlag());
639
640 bFileValid = (bFile ==
641 (rData.GetType() != SectionType::Content));
642 bPasswdValid = (aCurPasswd == rData.GetPassword());
643 }
644 bFirst = false;
645 return false;
646 });
647
648 m_xHideCB->set_state(!bHiddenValid ? TRISTATE_INDET :
649 bHidden ? TRISTATE_TRUE : TRISTATE_FALSE);
650 m_xProtectCB->set_state(!bProtectValid ? TRISTATE_INDET :
651 bProtect ? TRISTATE_TRUE : TRISTATE_FALSE);
652 // edit in readonly sections
653 m_xEditInReadonlyCB->set_state(!bEditInReadonlyValid ? TRISTATE_INDET :
654 bEditInReadonly ? TRISTATE_TRUE : TRISTATE_FALSE);
655
656 m_xFileCB->set_state(!bFileValid ? TRISTATE_INDET :
657 bFile ? TRISTATE_TRUE : TRISTATE_FALSE);
658
659 if (bConditionValid)
660 m_xConditionED->set_text(sCondition);
661 else
662 {
663 m_xConditionFT->set_sensitive(false);
664 m_xConditionED->set_sensitive(false);
665 }
666
667 m_xCurName->set_sensitive(false);
668 m_xDDECB->set_sensitive(false);
669 m_xDDEFrame->set_sensitive(false);
670 m_xOptionsPB->set_sensitive(false);
671 bool bPasswdEnabled = m_xProtectCB->get_state() == TRISTATE_TRUE;
672 m_xPasswdCB->set_sensitive(bPasswdEnabled);
673 m_xPasswdPB->set_sensitive(bPasswdEnabled);
674 if(!bPasswdValid)
675 {
676 rBox.get_selected(xIter.get());
677 rBox.unselect_all();
678 rBox.select(*xIter);
679 GetFirstEntryHdl(rBox);
680 return;
681 }
682 else
683 m_xPasswdCB->set_active(aCurPasswd.hasElements());
684 }
685 else if (bEntry )
686 {
687 m_xCurName->set_sensitive(true);
688 m_xOptionsPB->set_sensitive(true);
689 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
690 SwSectionData const& rData( pRepr->GetSectionData() );
691 m_xConditionED->set_text(rData.GetCondition());
692 m_xHideCB->set_sensitive(true);
693 m_xHideCB->set_state((rData.IsHidden()) ? TRISTATE_TRUE : TRISTATE_FALSE);
694 bool bHide = TRISTATE_TRUE == m_xHideCB->get_state();
695 m_xConditionED->set_sensitive(bHide);
696 m_xConditionFT->set_sensitive(bHide);
697 m_xPasswdCB->set_active(rData.GetPassword().hasElements());
698
699 m_xOK->set_sensitive(true);
700 m_xPasswdCB->set_sensitive(true);
701 m_xCurName->set_text(rBox.get_text(*xIter));
702 m_xCurName->set_sensitive(true);
703 m_xDismiss->set_sensitive(true);
704 const OUString aFile = pRepr->GetFile();
705 const OUString sSub = pRepr->GetSubRegion();
706 m_xSubRegionED->clear();
707 m_xSubRegionED->append_text(""); // put in a dummy entry, which is replaced when m_bSubRegionsFilled is set
708 m_bSubRegionsFilled = false;
709 if( !aFile.isEmpty() || !sSub.isEmpty() )
710 {
711 m_xFileCB->set_active(true);
712 m_xFileNameED->set_text(aFile);
713 m_xSubRegionED->set_entry_text(sSub);
714 m_xDDECB->set_active(rData.GetType() == SectionType::DdeLink);
715 }
716 else
717 {
718 m_xFileCB->set_active(false);
719 m_xFileNameED->set_text(aFile);
720 m_xDDECB->set_sensitive(false);
721 m_xDDECB->set_active(false);
722 }
723 UseFileHdl(*m_xFileCB);
724 DDEHdl(*m_xDDECB);
725 m_xProtectCB->set_state((rData.IsProtectFlag())
727 m_xProtectCB->set_sensitive(true);
728
729 // edit in readonly sections
730 m_xEditInReadonlyCB->set_state((rData.IsEditInReadonlyFlag())
732 m_xEditInReadonlyCB->set_sensitive(true);
733
734 bool bPasswdEnabled = m_xProtectCB->get_active();
735 m_xPasswdCB->set_sensitive(bPasswdEnabled);
736 m_xPasswdPB->set_sensitive(bPasswdEnabled);
737 }
738 m_bDontCheckPasswd = false;
739}
740
741// in OkHdl the modified settings are being applied and reversed regions are deleted
743{
744 // temp. Array because during changing of a region the position
745 // inside of the "Core-Arrays" can be shifted:
746 // - at linked regions, when they have more SubRegions or get
747 // new ones.
748 // StartUndo must certainly also happen not before the formats
749 // are copied (ClearRedo!)
750
751 const SwSectionFormats& rDocFormats = m_rSh.GetDoc()->GetSections();
752 SwSectionFormats aOrigArray(rDocFormats);
753
754 m_rSh.StartAllAction();
755 m_rSh.StartUndo();
756 m_rSh.ResetSelect( nullptr,false );
757
758 std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
759 if (m_xTree->get_iter_first(*xIter))
760 {
761 do
762 {
763 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
764 SwSectionFormat* pFormat = aOrigArray[ pRepr->GetArrPos() ];
765 if (!pRepr->GetSectionData().IsProtectFlag())
766 {
767 pRepr->GetSectionData().SetPassword(uno::Sequence<sal_Int8 >());
768 }
769 size_t nNewPos = rDocFormats.GetPos(pFormat);
770 if ( SIZE_MAX != nNewPos )
771 {
772 std::unique_ptr<SfxItemSet> pSet(pFormat->GetAttrSet().Clone( false ));
773 if( pFormat->GetCol() != pRepr->GetCol() )
774 pSet->Put( pRepr->GetCol() );
775
776 std::unique_ptr<SvxBrushItem> aBrush(pFormat->makeBackgroundBrushItem(false));
777 if( pRepr->GetBackground() && *aBrush != *pRepr->GetBackground() )
778 pSet->Put( *pRepr->GetBackground() );
779
780 if( pFormat->GetFootnoteAtTextEnd(false) != pRepr->GetFootnoteNtAtEnd() )
781 pSet->Put( pRepr->GetFootnoteNtAtEnd() );
782
783 if( pFormat->GetEndAtTextEnd(false) != pRepr->GetEndNtAtEnd() )
784 pSet->Put( pRepr->GetEndNtAtEnd() );
785
786 if( pFormat->GetBalancedColumns() != pRepr->GetBalance() )
787 pSet->Put( pRepr->GetBalance() );
788
789 if( pFormat->GetFrameDir() != *pRepr->GetFrameDir() )
790 pSet->Put( *pRepr->GetFrameDir() );
791
792 if( pFormat->GetLRSpace() != *pRepr->GetLRSpace())
793 pSet->Put( *pRepr->GetLRSpace());
794
795 m_rSh.UpdateSection( nNewPos, pRepr->GetSectionData(),
796 pSet->Count() ? pSet.get() : nullptr );
797 }
798 } while (m_xTree->iter_next(*xIter));
799 }
800
801 for (SectReprs_t::reverse_iterator it = m_SectReprs.rbegin(), aEnd = m_SectReprs.rend(); it != aEnd; ++it)
802 {
803 assert(it->first == it->second->GetArrPos());
804 SwSectionFormat* pFormat = aOrigArray[ it->second->GetArrPos() ];
805 const size_t nNewPos = rDocFormats.GetPos( pFormat );
806 if( SIZE_MAX != nNewPos )
807 m_rSh.DelSectionFormat( nNewPos );
808 }
809
810 aOrigArray.clear();
811
812 // response must be called ahead of EndAction's end,
813 // otherwise ScrollError can occur.
814 m_xDialog->response(RET_OK);
815
816 m_rSh.EndUndo();
817 m_rSh.EndAllAction();
818}
819
820// Toggle protect
821IMPL_LINK(SwEditRegionDlg, ChangeProtectHdl, weld::Toggleable&, rButton, void)
822{
823 if (!CheckPasswd(&rButton))
824 return;
825 bool bCheck = TRISTATE_TRUE == rButton.get_state();
826 m_xTree->selected_foreach([this, bCheck](weld::TreeIter& rEntry){
827 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
828 pRepr->GetSectionData().SetProtectFlag(bCheck);
829 OUString aImage = BuildBitmap(bCheck, TRISTATE_TRUE == m_xHideCB->get_state());
830 m_xTree->set_image(rEntry, aImage);
831 return false;
832 });
833 m_xPasswdCB->set_sensitive(bCheck);
834 m_xPasswdPB->set_sensitive(bCheck);
835}
836
837// Toggle hide
838IMPL_LINK( SwEditRegionDlg, ChangeHideHdl, weld::Toggleable&, rButton, void)
839{
840 if (!CheckPasswd(&rButton))
841 return;
842 m_xTree->selected_foreach([this, &rButton](weld::TreeIter& rEntry){
843 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
844 pRepr->GetSectionData().SetHidden(TRISTATE_TRUE == rButton.get_state());
845 OUString aImage = BuildBitmap(TRISTATE_TRUE == m_xProtectCB->get_state(),
846 TRISTATE_TRUE == rButton.get_state());
847 m_xTree->set_image(rEntry, aImage);
848 return false;
849 });
850 bool bHide = TRISTATE_TRUE == rButton.get_state();
851 m_xConditionED->set_sensitive(bHide);
852 m_xConditionFT->set_sensitive(bHide);
853}
854
855// Toggle edit in readonly
856IMPL_LINK(SwEditRegionDlg, ChangeEditInReadonlyHdl, weld::Toggleable&, rButton, void)
857{
858 if (!CheckPasswd(&rButton))
859 return;
860 m_xTree->selected_foreach([this, &rButton](weld::TreeIter& rEntry){
861 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
863 TRISTATE_TRUE == rButton.get_state());
864 return false;
865 });
866}
867
868// clear selected region
870{
871 if(!CheckPasswd())
872 return;
873 // at first mark all selected
874 m_xTree->selected_foreach([this](weld::TreeIter& rEntry){
875 SectRepr* const pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
876 pSectRepr->SetSelected();
877 return false;
878 });
879
880 std::unique_ptr<weld::TreeIter> xEntry(m_xTree->make_iterator());
881 bool bEntry(m_xTree->get_selected(xEntry.get()));
882 // then delete
883 while (bEntry)
884 {
885 SectRepr* const pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xEntry));
886 std::unique_ptr<weld::TreeIter> xRemove;
887 bool bRestart = false;
888 if (pSectRepr->IsSelected())
889 {
890 m_SectReprs.insert(std::make_pair(pSectRepr->GetArrPos(),
891 std::unique_ptr<SectRepr>(pSectRepr)));
892 if (m_xTree->iter_has_child(*xEntry))
893 {
894 std::unique_ptr<weld::TreeIter> xChild(m_xTree->make_iterator(xEntry.get()));
895 (void)m_xTree->iter_children(*xChild);
896 std::unique_ptr<weld::TreeIter> xParent(m_xTree->make_iterator(xEntry.get()));
897 if (!m_xTree->iter_parent(*xParent))
898 xParent.reset();
899 bool bChild = true;
900 do
901 {
902 // because of the repositioning we have to start at the beginning again
903 bRestart = true;
904 std::unique_ptr<weld::TreeIter> xMove(m_xTree->make_iterator(xChild.get()));
905 bChild = m_xTree->iter_next_sibling(*xChild);
906 m_xTree->move_subtree(*xMove, xParent.get(), m_xTree->get_iter_index_in_parent(*xEntry));
907 } while (bChild);
908 }
909 xRemove = m_xTree->make_iterator(xEntry.get());
910 }
911 if (bRestart)
912 bEntry = m_xTree->get_iter_first(*xEntry);
913 else
914 bEntry = m_xTree->iter_next(*xEntry);
915 if (xRemove)
916 m_xTree->remove(*xRemove);
917 }
918
919 if (m_xTree->get_selected(nullptr))
920 return;
921
922 m_xConditionFT->set_sensitive(false);
923 m_xConditionED->set_sensitive(false);
924 m_xDismiss->set_sensitive(false);
925 m_xCurName->set_sensitive(false);
926 m_xProtectCB->set_sensitive(false);
927 m_xPasswdCB->set_sensitive(false);
928 m_xHideCB->set_sensitive(false);
929 // edit in readonly sections
930 m_xEditInReadonlyCB->set_sensitive(false);
931 m_xEditInReadonlyCB->set_state(TRISTATE_FALSE);
932 m_xProtectCB->set_state(TRISTATE_FALSE);
933 m_xPasswdCB->set_active(false);
934 m_xHideCB->set_state(TRISTATE_FALSE);
935 m_xFileCB->set_active(false);
936 // otherwise the focus would be on HelpButton
937 m_xOK->grab_focus();
938 UseFileHdl(*m_xFileCB);
939}
940
941// link CheckBox to file?
942IMPL_LINK(SwEditRegionDlg, UseFileHdl, weld::Toggleable&, rButton, void)
943{
944 if (!CheckPasswd(&rButton))
945 return;
946 bool bMulti = 1 < m_xTree->count_selected_rows();
947 bool bFile = rButton.get_active();
948 if (m_xTree->get_selected(nullptr))
949 {
950 m_xTree->selected_foreach([&](weld::TreeIter& rEntry){
951 SectRepr* const pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
952 bool bContent = pSectRepr->IsContent();
953 if( rButton.get_active() && bContent && m_rSh.HasSelection() )
954 {
955 std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(m_xDialog.get(),
956 VclMessageType::Question, VclButtonsType::YesNo,
957 SwResId(STR_QUERY_CONNECT)));
958 if (RET_NO == xQueryBox->run())
959 rButton.set_active( false );
960 }
961 if( bFile )
962 pSectRepr->SetContent(false);
963 else
964 {
965 pSectRepr->SetFile(u"");
966 pSectRepr->SetSubRegion(std::u16string_view());
967 pSectRepr->GetSectionData().SetLinkFilePassword(OUString());
968 }
969 return false;
970 });
971 m_xDDECB->set_sensitive(bFile && !bMulti);
972 m_xDDEFrame->set_sensitive(bFile && !bMulti);
973 if( bFile )
974 {
975 m_xProtectCB->set_state(TRISTATE_TRUE);
976 m_xFileNameED->grab_focus();
977
978 }
979 else
980 {
981 m_xDDECB->set_active(false);
982 m_xSubRegionED->set_entry_text(OUString());
983 }
984 DDEHdl(*m_xDDECB);
985 }
986 else
987 {
988 rButton.set_active(false);
989 rButton.set_sensitive(false);
990 m_xDDECB->set_active(false);
991 m_xDDECB->set_sensitive(false);
992 m_xDDEFrame->set_sensitive(false);
993 }
994}
995
996// call dialog paste file
998{
999 if(!CheckPasswd())
1000 return;
1001 m_pDocInserter.reset(new ::sfx2::DocumentInserter(m_xDialog.get(), "swriter"));
1002 m_pDocInserter->StartExecuteModal( LINK( this, SwEditRegionDlg, DlgClosedHdl ) );
1003}
1004
1006{
1007 if(!CheckPasswd())
1008 return;
1009 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1010 if (!pSectRepr)
1011 return;
1012
1020 SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE> aSet( m_rSh.GetView().GetPool() );
1021
1022 aSet.Put( pSectRepr->GetCol() );
1023 aSet.Put( *pSectRepr->GetBackground() );
1024 aSet.Put( pSectRepr->GetFootnoteNtAtEnd() );
1025 aSet.Put( pSectRepr->GetEndNtAtEnd() );
1026 aSet.Put( pSectRepr->GetBalance() );
1027 aSet.Put( *pSectRepr->GetFrameDir() );
1028 aSet.Put( *pSectRepr->GetLRSpace() );
1029
1030 const SwSectionFormats& rDocFormats = m_rSh.GetDoc()->GetSections();
1031 SwSectionFormats aOrigArray(rDocFormats);
1032
1033 SwSectionFormat* pFormat = aOrigArray[pSectRepr->GetArrPos()];
1034 tools::Long nWidth = m_rSh.GetSectionWidth(*pFormat);
1035 aOrigArray.clear();
1036 if (!nWidth)
1037 nWidth = USHRT_MAX;
1038
1039 aSet.Put(SwFormatFrameSize(SwFrameSize::Variable, nWidth));
1040 aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
1041
1042 SwSectionPropertyTabDialog aTabDlg(m_xDialog.get(), aSet, m_rSh);
1043 if (RET_OK != aTabDlg.run())
1044 return;
1045
1046 const SfxItemSet* pOutSet = aTabDlg.GetOutputItemSet();
1047 if( !(pOutSet && pOutSet->Count()) )
1048 return;
1049
1050 const SwFormatCol* pColItem = pOutSet->GetItemIfSet(
1051 RES_COL, false );
1052 const SvxBrushItem* pBrushItem = pOutSet->GetItemIfSet(
1053 RES_BACKGROUND, false );
1054 const SwFormatFootnoteAtTextEnd* pFootnoteItem = pOutSet->GetItemIfSet(
1055 RES_FTN_AT_TXTEND, false );
1056 const SwFormatEndAtTextEnd* pEndItem = pOutSet->GetItemIfSet(
1057 RES_END_AT_TXTEND, false );
1058 const SwFormatNoBalancedColumns* pBalanceItem = pOutSet->GetItemIfSet(
1059 RES_COLUMNBALANCE, false );
1060 const SvxFrameDirectionItem* pFrameDirItem = pOutSet->GetItemIfSet(
1061 RES_FRAMEDIR, false );
1062 const SvxLRSpaceItem* pLRSpaceItem = pOutSet->GetItemIfSet(
1063 RES_LR_SPACE, false );
1064
1065 if( !(pColItem ||
1066 pBrushItem ||
1067 pFootnoteItem ||
1068 pEndItem ||
1069 pBalanceItem ||
1070 pFrameDirItem ||
1071 pLRSpaceItem) )
1072 return;
1073
1074 m_xTree->selected_foreach([&](weld::TreeIter& rEntry)
1075 {
1076 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
1077 if (pColItem)
1078 pRepr->GetCol() = *pColItem;
1079 if (pBrushItem)
1080 pRepr->GetBackground().reset(pBrushItem->Clone());
1081 if (pFootnoteItem)
1082 pRepr->GetFootnoteNtAtEnd() = *pFootnoteItem;
1083 if (pEndItem)
1084 pRepr->GetEndNtAtEnd() = *pEndItem;
1085 if (pBalanceItem)
1086 pRepr->GetBalance().SetValue(pBalanceItem->GetValue());
1087 if (pFrameDirItem)
1088 pRepr->GetFrameDir()->SetValue(pFrameDirItem->GetValue());
1089 if (pLRSpaceItem)
1090 pRepr->GetLRSpace().reset(pLRSpaceItem->Clone());
1091 return false;
1092 });
1093}
1094
1095IMPL_LINK(SwEditRegionDlg, FileNameComboBoxHdl, weld::ComboBox&, rEdit, void)
1096{
1097 int nStartPos, nEndPos;
1098 rEdit.get_entry_selection_bounds(nStartPos, nEndPos);
1099 if (!CheckPasswd())
1100 return;
1101 rEdit.select_entry_region(nStartPos, nEndPos);
1102 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1103 pSectRepr->SetSubRegion( rEdit.get_active_text() );
1104}
1105
1106// Applying of the filename or the linked region
1107IMPL_LINK(SwEditRegionDlg, FileNameEntryHdl, weld::Entry&, rEdit, void)
1108{
1109 int nStartPos, nEndPos;
1110 rEdit.get_selection_bounds(nStartPos, nEndPos);
1111 if (!CheckPasswd())
1112 return;
1113 rEdit.select_region(nStartPos, nEndPos);
1114 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1115 m_xSubRegionED->clear();
1116 m_xSubRegionED->append_text(""); // put in a dummy entry, which is replaced when m_bSubRegionsFilled is set
1117 m_bSubRegionsFilled = false;
1118 if (m_xDDECB->get_active())
1119 {
1120 OUString sLink( CollapseWhiteSpaces(rEdit.get_text()) );
1121 sal_Int32 nPos = 0;
1122 sLink = sLink.replaceFirst( " ", OUStringChar(sfx2::cTokenSeparator), &nPos );
1123 if (nPos>=0)
1124 {
1125 sLink = sLink.replaceFirst( " ", OUStringChar(sfx2::cTokenSeparator), &nPos );
1126 }
1127
1128 pSectRepr->GetSectionData().SetLinkFileName( sLink );
1130 }
1131 else
1132 {
1133 OUString sTmp(rEdit.get_text());
1134 if(!sTmp.isEmpty())
1135 {
1136 SfxMedium* pMedium = m_rSh.GetView().GetDocShell()->GetMedium();
1137 INetURLObject aAbs;
1138 if( pMedium )
1139 aAbs = pMedium->GetURLObject();
1141 aAbs, sTmp, URIHelper::GetMaybeFileHdl() );
1142 }
1143 pSectRepr->SetFile( sTmp );
1144 pSectRepr->GetSectionData().SetLinkFilePassword(OUString());
1145 }
1146}
1147
1149{
1150 if (!CheckPasswd(&rButton))
1151 return;
1152 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1153 if (!pSectRepr)
1154 return;
1155
1156 bool bFile = m_xFileCB->get_active();
1157 SwSectionData & rData( pSectRepr->GetSectionData() );
1158 bool bDDE = rButton.get_active();
1159 if(bDDE)
1160 {
1161 m_xFileNameFT->hide();
1162 m_xDDECommandFT->set_sensitive(true);
1163 m_xDDECommandFT->show();
1164 m_xSubRegionFT->hide();
1165 m_xSubRegionED->hide();
1166 if (SectionType::FileLink == rData.GetType())
1167 {
1168 pSectRepr->SetFile(u"");
1169 m_xFileNameED->set_text(OUString());
1170 rData.SetLinkFilePassword(OUString());
1171 }
1173 }
1174 else
1175 {
1176 m_xDDECommandFT->hide();
1177 m_xFileNameFT->set_sensitive(bFile);
1178 m_xFileNameFT->show();
1179 m_xSubRegionED->show();
1180 m_xSubRegionFT->show();
1181 m_xSubRegionED->set_sensitive(bFile);
1182 m_xSubRegionFT->set_sensitive(bFile);
1183 m_xSubRegionED->set_sensitive(bFile);
1184 if (SectionType::DdeLink == rData.GetType())
1185 {
1187 pSectRepr->SetFile(u"");
1188 rData.SetLinkFilePassword(OUString());
1189 m_xFileNameED->set_text(OUString());
1190 }
1191 }
1192 m_xFilePB->set_sensitive(bFile && !bDDE);
1193}
1194
1196{
1197 if (!CheckPasswd())
1198 {
1199 if (!bChange)
1200 m_xPasswdCB->set_active(!m_xPasswdCB->get_active());
1201 return;
1202 }
1203
1204 bool bSet = bChange ? bChange : m_xPasswdCB->get_active();
1205
1206 m_xTree->selected_foreach([this, bChange, bSet](weld::TreeIter& rEntry){
1207 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
1208 if(bSet)
1209 {
1210 if(!pRepr->GetTempPasswd().hasElements() || bChange)
1211 {
1212 SfxPasswordDialog aPasswdDlg(m_xDialog.get());
1213 aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM);
1214 if (RET_OK == aPasswdDlg.run())
1215 {
1216 const OUString sNewPasswd(aPasswdDlg.GetPassword());
1217 if (aPasswdDlg.GetConfirm() == sNewPasswd)
1218 {
1219 SvPasswordHelper::GetHashPassword( pRepr->GetTempPasswd(), sNewPasswd );
1220 }
1221 else
1222 {
1223 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
1224 VclMessageType::Info, VclButtonsType::Ok,
1225 SwResId(STR_WRONG_PASSWD_REPEAT)));
1226 xInfoBox->run();
1227 ChangePasswd(bChange);
1228 return true;
1229 }
1230 }
1231 else
1232 {
1233 if(!bChange)
1234 m_xPasswdCB->set_active(false);
1235 return true;
1236 }
1237 }
1238 pRepr->GetSectionData().SetPassword(pRepr->GetTempPasswd());
1239 }
1240 else
1241 {
1242 pRepr->GetSectionData().SetPassword(uno::Sequence<sal_Int8 >());
1243 }
1244 return false;
1245 });
1246}
1247
1249{
1250 ChangePasswd(false);
1251}
1252
1254{
1255 ChangePasswd(true);
1256}
1257
1258// the current region name is being added to the TreeListBox immediately during
1259// editing, with empty string no Ok()
1261{
1262 if(!CheckPasswd())
1263 return;
1264 std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
1265 if (m_xTree->get_selected(xIter.get()))
1266 {
1267 const OUString aName = m_xCurName->get_text();
1268 m_xTree->set_text(*xIter, aName);
1269 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
1271
1272 m_xOK->set_sensitive(!aName.isEmpty());
1273 }
1274}
1275
1276IMPL_LINK( SwEditRegionDlg, ConditionEditHdl, weld::Entry&, rEdit, void )
1277{
1278 int nStartPos, nEndPos;
1279 rEdit.get_selection_bounds(nStartPos, nEndPos);
1280 if(!CheckPasswd())
1281 return;
1282 rEdit.select_region(nStartPos, nEndPos);
1283
1284 m_xTree->selected_foreach([this, &rEdit](weld::TreeIter& rEntry){
1285 SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
1286 pRepr->GetSectionData().SetCondition(rEdit.get_text());
1287 return false;
1288 });
1289}
1290
1291IMPL_LINK( SwEditRegionDlg, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg, void )
1292{
1293 OUString sFileName, sFilterName, sPassword;
1294 if ( _pFileDlg->GetError() == ERRCODE_NONE )
1295 {
1296 std::unique_ptr<SfxMedium> pMedium(m_pDocInserter->CreateMedium("sglobal"));
1297 if ( pMedium )
1298 {
1299 sFileName = pMedium->GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE );
1300 sFilterName = pMedium->GetFilter()->GetFilterName();
1301 if ( const SfxStringItem* pItem = pMedium->GetItemSet()->GetItemIfSet( SID_PASSWORD, false ) )
1302 sPassword = pItem->GetValue();
1303 ::lcl_ReadSections(*pMedium, *m_xSubRegionED);
1304 }
1305 }
1306
1307 SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
1308 if (pSectRepr)
1309 {
1310 pSectRepr->SetFile( sFileName );
1311 pSectRepr->SetFilter( sFilterName );
1312 pSectRepr->GetSectionData().SetLinkFilePassword(sPassword);
1313 m_xFileNameED->set_text(pSectRepr->GetFile());
1314 }
1315}
1316
1318{
1319 if (m_bSubRegionsFilled)
1320 return;
1321
1322 //if necessary fill the names bookmarks/sections/tables now
1323
1324 OUString sFileName = m_xFileNameED->get_text();
1325 if(!sFileName.isEmpty())
1326 {
1327 SfxMedium* pMedium = m_rSh.GetView().GetDocShell()->GetMedium();
1328 INetURLObject aAbs;
1329 if( pMedium )
1330 aAbs = pMedium->GetURLObject();
1331 sFileName = URIHelper::SmartRel2Abs(
1332 aAbs, sFileName, URIHelper::GetMaybeFileHdl() );
1333
1334 //load file and set the shell
1335 SfxMedium aMedium( sFileName, StreamMode::STD_READ );
1337 ::lcl_ReadSections(aMedium, *m_xSubRegionED);
1338 }
1339 else
1340 lcl_FillSubRegionList(m_rSh, *m_xSubRegionED, nullptr);
1341 m_bSubRegionsFilled = true;
1342}
1343
1344// helper function - read section names from medium
1345static void lcl_ReadSections( SfxMedium& rMedium, weld::ComboBox& rBox )
1346{
1347 rBox.clear();
1348 uno::Reference < embed::XStorage > xStg;
1349 if( !(rMedium.IsStorage() && (xStg = rMedium.GetStorage()).is()) )
1350 return;
1351
1352 std::vector<OUString> aArr;
1354 if ( nFormat == SotClipboardFormatId::STARWRITER_60 || nFormat == SotClipboardFormatId::STARWRITERGLOB_60 ||
1355 nFormat == SotClipboardFormatId::STARWRITER_8 || nFormat == SotClipboardFormatId::STARWRITERGLOB_8)
1356 SwGetReaderXML()->GetSectionList( rMedium, aArr );
1357
1358 for (auto const& it : aArr)
1359 {
1360 rBox.append_text(it);
1361 }
1362}
1363
1365 weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh)
1366 : SfxTabDialogController(pParent, "modules/swriter/ui/insertsectiondialog.ui",
1367 "InsertSectionDialog",&rSet)
1368 , m_rWrtSh(rSh)
1369{
1371 AddTabPage("section", SwInsertSectionTabPage::Create, nullptr);
1372 AddTabPage("columns", SwColumnPage::Create, nullptr);
1373 AddTabPage("background", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_BKG), nullptr);
1375 AddTabPage("indents", SwSectionIndentTabPage::Create, nullptr);
1376
1378
1379 bool bWeb = dynamic_cast<SwWebDocShell*>( rSh.GetView().GetDocShell() ) != nullptr ;
1380 if(bWeb)
1381 {
1382 RemoveTabPage("notes");
1383 RemoveTabPage("indents");
1384 if( HTML_CFG_NS40 != nHtmlMode && HTML_CFG_WRITER != nHtmlMode)
1385 RemoveTabPage("columns");
1386 }
1387 SetCurPageId("section");
1388}
1389
1391{
1392}
1393
1395{
1396 if (rId == "section")
1397 static_cast<SwInsertSectionTabPage&>(rPage).SetWrtShell(m_rWrtSh);
1398 else if (rId == "background")
1399 {
1400 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
1401 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_SELECTOR)));
1402 rPage.PageCreated(aSet);
1403 }
1404 else if (rId == "columns")
1405 {
1407 static_cast<SwColumnPage&>(rPage).SetPageWidth(rSize.GetWidth());
1408 static_cast<SwColumnPage&>(rPage).ShowBalance(true);
1409 static_cast<SwColumnPage&>(rPage).SetInSection(true);
1410 }
1411 else if (rId == "indents")
1412 static_cast<SwSectionIndentTabPage&>(rPage).SetWrtShell(m_rWrtSh);
1413}
1414
1416{
1417 m_pSectionData.reset( new SwSectionData(rSect) );
1418}
1419
1421{
1422 short nRet = SfxTabDialogController::Ok();
1423 OSL_ENSURE(m_pSectionData, "SwInsertSectionTabDialog: no SectionData?");
1424 const SfxItemSet* pOutputItemSet = GetOutputItemSet();
1425 m_rWrtSh.InsertSection(*m_pSectionData, pOutputItemSet);
1426 SfxViewFrame& rViewFrame = m_rWrtSh.GetView().GetViewFrame();
1427 uno::Reference< frame::XDispatchRecorder > xRecorder =
1428 rViewFrame.GetBindings().GetRecorder();
1429 if ( xRecorder.is() )
1430 {
1431 SfxRequest aRequest(rViewFrame, FN_INSERT_REGION);
1432 if(const SwFormatCol* pCol = pOutputItemSet->GetItemIfSet(RES_COL, false))
1433 {
1434 aRequest.AppendItem(SfxUInt16Item(SID_ATTR_COLUMNS,
1435 pCol->GetColumns().size()));
1436 }
1438 m_pSectionData->GetSectionName()));
1440 m_pSectionData->GetCondition()));
1442 m_pSectionData->IsHidden()));
1444 m_pSectionData->IsProtectFlag()));
1445 // edit in readonly sections
1447 m_pSectionData->IsEditInReadonlyFlag()));
1448
1449 const OUString sLinkFileName( m_pSectionData->GetLinkFileName() );
1450 sal_Int32 n = 0;
1451 aRequest.AppendItem(SfxStringItem( FN_PARAM_1, sLinkFileName.getToken( 0, sfx2::cTokenSeparator, n )));
1452 aRequest.AppendItem(SfxStringItem( FN_PARAM_2, sLinkFileName.getToken( 0, sfx2::cTokenSeparator, n )));
1453 aRequest.AppendItem(SfxStringItem( FN_PARAM_3, sLinkFileName.getToken( 0, sfx2::cTokenSeparator, n )));
1454 aRequest.Done();
1455 }
1456 return nRet;
1457}
1458
1460 : SfxTabPage(pPage, pController, "modules/swriter/ui/sectionpage.ui", "SectionPage", &rAttrSet)
1461 , m_pWrtSh(nullptr)
1462 , m_xCurName(m_xBuilder->weld_entry_tree_view("sectionnames", "sectionnames-entry",
1463 "sectionnames-list"))
1464 , m_xFileCB(m_xBuilder->weld_check_button("link"))
1465 , m_xDDECB(m_xBuilder->weld_check_button("dde"))
1466 , m_xDDECommandFT(m_xBuilder->weld_label("ddelabel"))
1467 , m_xFileNameFT(m_xBuilder->weld_label("filelabel"))
1468 , m_xFileNameED(m_xBuilder->weld_entry("filename"))
1469 , m_xFilePB(m_xBuilder->weld_button("selectfile"))
1470 , m_xSubRegionFT(m_xBuilder->weld_label("sectionlabel"))
1471 , m_xSubRegionED(m_xBuilder->weld_combo_box("sectionname"))
1472 , m_xProtectCB(m_xBuilder->weld_check_button("protect"))
1473 , m_xPasswdCB(m_xBuilder->weld_check_button("withpassword"))
1474 , m_xPasswdPB(m_xBuilder->weld_button("selectpassword"))
1475 , m_xHideCB(m_xBuilder->weld_check_button("hide"))
1476 , m_xConditionFT(m_xBuilder->weld_label("condlabel"))
1477 , m_xConditionED(new ConditionEdit(m_xBuilder->weld_entry("withcond")))
1478 // edit in readonly sections
1479 , m_xEditInReadonlyCB(m_xBuilder->weld_check_button("editable"))
1480{
1481 m_xCurName->make_sorted();
1482 m_xCurName->set_height_request_by_rows(12);
1483 m_xSubRegionED->make_sorted();
1484
1485 m_xProtectCB->connect_toggled( LINK( this, SwInsertSectionTabPage, ChangeProtectHdl));
1486 m_xPasswdCB->connect_toggled( LINK( this, SwInsertSectionTabPage, TogglePasswdHdl));
1487 m_xPasswdPB->connect_clicked( LINK( this, SwInsertSectionTabPage, ChangePasswdHdl));
1488 m_xHideCB->connect_toggled( LINK( this, SwInsertSectionTabPage, ChangeHideHdl));
1489 m_xFileCB->connect_toggled( LINK( this, SwInsertSectionTabPage, UseFileHdl ));
1490 m_xFilePB->connect_clicked( LINK( this, SwInsertSectionTabPage, FileSearchHdl ));
1491 m_xCurName->connect_changed( LINK( this, SwInsertSectionTabPage, NameEditHdl));
1492 m_xDDECB->connect_toggled( LINK( this, SwInsertSectionTabPage, DDEHdl ));
1493 ChangeProtectHdl(*m_xProtectCB);
1494 m_xSubRegionED->set_entry_completion(true, true);
1495
1496 // Hide Link section. In general it makes no sense to insert a file from the jail,
1497 // because it does not contain any usable files (documents).
1499 {
1500 m_xBuilder->weld_label("label1")->hide(); // Link
1501 m_xFileCB->hide();
1502 m_xDDECB->hide();
1503 m_xDDECommandFT->hide();
1504 m_xFileNameFT->hide();
1505 m_xFileNameED->hide();
1506 m_xFilePB->hide();
1507 m_xSubRegionFT->hide();
1508 m_xSubRegionED->hide();
1509 }
1510}
1511
1513{
1514}
1515
1517{
1518 m_pWrtSh = &rSh;
1519
1520 bool bWeb = dynamic_cast<SwWebDocShell*>( m_pWrtSh->GetView().GetDocShell() )!= nullptr;
1521 if(bWeb)
1522 {
1523 m_xHideCB->hide();
1524 m_xConditionED->hide();
1525 m_xConditionFT->hide();
1526 m_xDDECB->hide();
1527 m_xDDECommandFT->hide();
1528 }
1529
1531
1532 SwSectionData *const pSectionData =
1534 ->GetSectionData();
1535 if (pSectionData) // something set?
1536 {
1537 const OUString sSectionName(pSectionData->GetSectionName());
1538 m_xCurName->set_entry_text(rSh.GetUniqueSectionName(&sSectionName));
1539 m_xProtectCB->set_active( pSectionData->IsProtectFlag() );
1540 ChangeProtectHdl(*m_xProtectCB);
1541 m_sFileName = pSectionData->GetLinkFileName();
1542 m_sFilePasswd = pSectionData->GetLinkFilePassword();
1543 m_xFileCB->set_active( !m_sFileName.isEmpty() );
1544 m_xFileNameED->set_text( m_sFileName );
1545 UseFileHdl(*m_xFileCB);
1546 }
1547 else
1548 {
1549 m_xCurName->set_entry_text(rSh.GetUniqueSectionName());
1550 }
1551}
1552
1554{
1555 SwSectionData aSection(SectionType::Content, m_xCurName->get_active_text());
1556 aSection.SetCondition(m_xConditionED->get_text());
1557 bool bProtected = m_xProtectCB->get_active();
1558 aSection.SetProtectFlag(bProtected);
1559 aSection.SetHidden(m_xHideCB->get_active());
1560 // edit in readonly sections
1561 aSection.SetEditInReadonlyFlag(m_xEditInReadonlyCB->get_active());
1562
1563 if(bProtected)
1564 {
1565 aSection.SetPassword(m_aNewPasswd);
1566 }
1567 const OUString sFileName = m_xFileNameED->get_text();
1568 const OUString sSubRegion = m_xSubRegionED->get_active_text();
1569 bool bDDe = m_xDDECB->get_active();
1570 if (m_xFileCB->get_active() && (!sFileName.isEmpty() || !sSubRegion.isEmpty() || bDDe))
1571 {
1572 OUString aLinkFile;
1573 if( bDDe )
1574 {
1575 aLinkFile = CollapseWhiteSpaces(sFileName);
1576 sal_Int32 nPos = 0;
1577 aLinkFile = aLinkFile.replaceFirst( " ", OUStringChar(sfx2::cTokenSeparator), &nPos );
1578 if (nPos>=0)
1579 {
1580 aLinkFile = aLinkFile.replaceFirst( " ", OUStringChar(sfx2::cTokenSeparator), &nPos );
1581 }
1582 }
1583 else
1584 {
1585 if(!sFileName.isEmpty())
1586 {
1587 SfxMedium* pMedium = m_pWrtSh->GetView().GetDocShell()->GetMedium();
1588 INetURLObject aAbs;
1589 if( pMedium )
1590 aAbs = pMedium->GetURLObject();
1591 aLinkFile = URIHelper::SmartRel2Abs(
1592 aAbs, sFileName, URIHelper::GetMaybeFileHdl() );
1594 }
1595
1596 aLinkFile += OUStringChar(sfx2::cTokenSeparator) + m_sFilterName
1597 + OUStringChar(sfx2::cTokenSeparator) + sSubRegion;
1598 }
1599
1600 aSection.SetLinkFileName(aLinkFile);
1601 if (!aLinkFile.isEmpty())
1602 {
1603 aSection.SetType( m_xDDECB->get_active() ?
1606 }
1607 }
1608 static_cast<SwInsertSectionTabDialog*>(GetDialogController())->SetSectionData(aSection);
1609 return true;
1610}
1611
1613{
1614}
1615
1616std::unique_ptr<SfxTabPage> SwInsertSectionTabPage::Create(weld::Container* pPage, weld::DialogController* pController,
1617 const SfxItemSet* rAttrSet)
1618{
1619 return std::make_unique<SwInsertSectionTabPage>(pPage, pController, *rAttrSet);
1620}
1621
1623{
1624 bool bHide = rBox.get_active();
1625 m_xConditionED->set_sensitive(bHide);
1626 m_xConditionFT->set_sensitive(bHide);
1627}
1628
1629IMPL_LINK(SwInsertSectionTabPage, ChangeProtectHdl, weld::Toggleable&, rBox, void)
1630{
1631 bool bCheck = rBox.get_active();
1632 m_xPasswdCB->set_sensitive(bCheck);
1633 m_xPasswdPB->set_sensitive(bCheck);
1634}
1635
1637{
1638 bool bSet = bChange ? bChange : m_xPasswdCB->get_active();
1639 if (bSet)
1640 {
1641 if(!m_aNewPasswd.hasElements() || bChange)
1642 {
1643 SfxPasswordDialog aPasswdDlg(GetFrameWeld());
1644 aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM);
1645 if (RET_OK == aPasswdDlg.run())
1646 {
1647 const OUString sNewPasswd(aPasswdDlg.GetPassword());
1648 if (aPasswdDlg.GetConfirm() == sNewPasswd)
1649 {
1651 }
1652 else
1653 {
1654 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
1655 VclMessageType::Info, VclButtonsType::Ok,
1656 SwResId(STR_WRONG_PASSWD_REPEAT)));
1657 xInfoBox->run();
1658 }
1659 }
1660 else if(!bChange)
1661 m_xPasswdCB->set_active(false);
1662 }
1663 }
1664 else
1665 m_aNewPasswd.realloc(0);
1666}
1667
1669{
1670 ChangePasswd(false);
1671}
1672
1674{
1675 ChangePasswd(true);
1676}
1677
1678
1680{
1681 const OUString aName = m_xCurName->get_active_text();
1682 GetDialogController()->GetOKButton().set_sensitive(!aName.isEmpty() &&
1683 m_xCurName->find_text(aName) == -1);
1684}
1685
1687{
1688 if (rButton.get_active())
1689 {
1690 if (m_pWrtSh->HasSelection())
1691 {
1692 std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
1693 VclMessageType::Question, VclButtonsType::YesNo,
1694 SwResId(STR_QUERY_CONNECT)));
1695 if (RET_NO == xQueryBox->run())
1696 rButton.set_active(false);
1697 }
1698 }
1699
1700 bool bFile = rButton.get_active();
1701 m_xFileNameFT->set_sensitive(bFile);
1702 m_xFileNameED->set_sensitive(bFile);
1703 m_xFilePB->set_sensitive(bFile);
1704 m_xSubRegionFT->set_sensitive(bFile);
1705 m_xSubRegionED->set_sensitive(bFile);
1706 m_xDDECommandFT->set_sensitive(bFile);
1707 m_xDDECB->set_sensitive(bFile);
1708 if (bFile)
1709 {
1710 m_xFileNameED->grab_focus();
1711 m_xProtectCB->set_active(true);
1712 ChangeProtectHdl(*m_xProtectCB);
1713 }
1714 else
1715 {
1716 m_xDDECB->set_active(false);
1717 DDEHdl(*m_xDDECB);
1718 }
1719}
1720
1722{
1723 m_pDocInserter.reset(new ::sfx2::DocumentInserter(GetFrameWeld(), "swriter"));
1724 m_pDocInserter->StartExecuteModal( LINK( this, SwInsertSectionTabPage, DlgClosedHdl ) );
1725}
1726
1728{
1729 bool bDDE = rButton.get_active();
1730 bool bFile = m_xFileCB->get_active();
1731 m_xFilePB->set_sensitive(!bDDE && bFile);
1732 if (bDDE)
1733 {
1734 m_xFileNameFT->hide();
1735 m_xDDECommandFT->set_sensitive(bDDE);
1736 m_xDDECommandFT->show();
1737 m_xSubRegionFT->hide();
1738 m_xSubRegionED->hide();
1739 m_xFileNameED->set_accessible_name(m_xDDECommandFT->get_label());
1740 }
1741 else
1742 {
1743 m_xDDECommandFT->hide();
1744 m_xFileNameFT->set_sensitive(bFile);
1745 m_xFileNameFT->show();
1746 m_xSubRegionFT->show();
1747 m_xSubRegionED->show();
1748 m_xSubRegionED->set_sensitive(bFile);
1749 m_xFileNameED->set_accessible_name(m_xFileNameFT->get_label());
1750 }
1751}
1752
1753IMPL_LINK( SwInsertSectionTabPage, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg, void )
1754{
1755 if ( _pFileDlg->GetError() == ERRCODE_NONE )
1756 {
1757 std::unique_ptr<SfxMedium> pMedium(m_pDocInserter->CreateMedium("sglobal"));
1758 if ( pMedium )
1759 {
1760 m_sFileName = pMedium->GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE );
1761 m_sFilterName = pMedium->GetFilter()->GetFilterName();
1762 if ( const SfxStringItem* pItem = pMedium->GetItemSet()->GetItemIfSet( SID_PASSWORD, false ) )
1763 m_sFilePasswd = pItem->GetValue();
1764 m_xFileNameED->set_text( INetURLObject::decode(
1766 ::lcl_ReadSections(*pMedium, *m_xSubRegionED);
1767 }
1768 }
1769 else
1770 {
1771 m_sFilterName.clear();
1772 m_sFilePasswd.clear();
1773 }
1774}
1775
1777 : SfxTabPage(pPage, pController, "modules/swriter/ui/footnotesendnotestabpage.ui", "FootnotesEndnotesTabPage", &rAttrSet)
1778 , m_xFootnoteNtAtTextEndCB(m_xBuilder->weld_check_button("ftnntattextend"))
1779 , m_xFootnoteNtNumCB(m_xBuilder->weld_check_button("ftnntnum"))
1780 , m_xFootnoteOffsetLbl(m_xBuilder->weld_label("ftnoffset_label"))
1781 , m_xFootnoteOffsetField(m_xBuilder->weld_spin_button("ftnoffset"))
1782 , m_xFootnoteNtNumFormatCB(m_xBuilder->weld_check_button("ftnntnumfmt"))
1783 , m_xFootnotePrefixFT(m_xBuilder->weld_label("ftnprefix_label"))
1784 , m_xFootnotePrefixED(m_xBuilder->weld_entry("ftnprefix"))
1785 , m_xFootnoteNumViewBox(new SwNumberingTypeListBox(m_xBuilder->weld_combo_box("ftnnumviewbox")))
1786 , m_xFootnoteSuffixFT(m_xBuilder->weld_label("ftnsuffix_label"))
1787 , m_xFootnoteSuffixED(m_xBuilder->weld_entry("ftnsuffix"))
1788 , m_xEndNtAtTextEndCB(m_xBuilder->weld_check_button("endntattextend"))
1789 , m_xEndNtNumCB(m_xBuilder->weld_check_button("endntnum"))
1790 , m_xEndOffsetLbl(m_xBuilder->weld_label("endoffset_label"))
1791 , m_xEndOffsetField(m_xBuilder->weld_spin_button("endoffset"))
1792 , m_xEndNtNumFormatCB(m_xBuilder->weld_check_button("endntnumfmt"))
1793 , m_xEndPrefixFT(m_xBuilder->weld_label("endprefix_label"))
1794 , m_xEndPrefixED(m_xBuilder->weld_entry("endprefix"))
1795 , m_xEndNumViewBox(new SwNumberingTypeListBox(m_xBuilder->weld_combo_box("endnumviewbox")))
1796 , m_xEndSuffixFT(m_xBuilder->weld_label("endsuffix_label"))
1797 , m_xEndSuffixED(m_xBuilder->weld_entry("endsuffix"))
1798{
1801
1803 m_xFootnoteNtAtTextEndCB->connect_toggled( aLk );
1804 m_xFootnoteNtNumCB->connect_toggled( aLk );
1805 m_xEndNtAtTextEndCB->connect_toggled( aLk );
1806 m_xEndNtNumCB->connect_toggled( aLk );
1807 m_xFootnoteNtNumFormatCB->connect_toggled( aLk );
1808 m_xEndNtNumFormatCB->connect_toggled( aLk );
1809}
1810
1812{
1813}
1814
1816{
1818 ? ( m_xFootnoteNtNumCB->get_active()
1819 ? ( m_xFootnoteNtNumFormatCB->get_active()
1822 : FTNEND_ATTXTEND )
1824
1825 switch( aFootnote.GetValue() )
1826 {
1828 aFootnote.SetNumType( m_xFootnoteNumViewBox->GetSelectedNumberingType() );
1829 aFootnote.SetPrefix( m_xFootnotePrefixED->get_text().replaceAll("\\t", "\t") ); // fdo#65666
1830 aFootnote.SetSuffix( m_xFootnoteSuffixED->get_text().replaceAll("\\t", "\t") );
1831 [[fallthrough]];
1832
1834 aFootnote.SetOffset( static_cast< sal_uInt16 >( m_xFootnoteOffsetField->get_value()-1 ) );
1835 break;
1836 default: break;
1837 }
1838
1839 SwFormatEndAtTextEnd aEnd( m_xEndNtAtTextEndCB->get_active()
1840 ? ( m_xEndNtNumCB->get_active()
1841 ? ( m_xEndNtNumFormatCB->get_active()
1844 : FTNEND_ATTXTEND )
1846
1847 switch( aEnd.GetValue() )
1848 {
1850 aEnd.SetNumType( m_xEndNumViewBox->GetSelectedNumberingType() );
1851 aEnd.SetPrefix( m_xEndPrefixED->get_text().replaceAll("\\t", "\t") );
1852 aEnd.SetSuffix( m_xEndSuffixED->get_text().replaceAll("\\t", "\t") );
1853 [[fallthrough]];
1854
1856 aEnd.SetOffset( static_cast< sal_uInt16 >( m_xEndOffsetField->get_value()-1 ) );
1857 break;
1858 default: break;
1859 }
1860
1861 rSet->Put( aFootnote );
1862 rSet->Put( aEnd );
1863
1864 return true;
1865}
1866
1868 const SwFormatFootnoteEndAtTextEnd& rAttr )
1869{
1870 weld::CheckButton *pNtAtTextEndCB, *pNtNumCB, *pNtNumFormatCB;
1871 weld::Label *pPrefixFT, *pSuffixFT;
1872 weld::Entry *pPrefixED, *pSuffixED;
1873 SwNumberingTypeListBox *pNumViewBox;
1874 weld::Label *pOffsetText;
1875 weld::SpinButton *pOffsetField;
1876
1877 if( bFootnote )
1878 {
1879 pNtAtTextEndCB = m_xFootnoteNtAtTextEndCB.get();
1880 pNtNumCB = m_xFootnoteNtNumCB.get();
1881 pNtNumFormatCB = m_xFootnoteNtNumFormatCB.get();
1882 pPrefixFT = m_xFootnotePrefixFT.get();
1883 pPrefixED = m_xFootnotePrefixED.get();
1884 pSuffixFT = m_xFootnoteSuffixFT.get();
1885 pSuffixED = m_xFootnoteSuffixED.get();
1886 pNumViewBox = m_xFootnoteNumViewBox.get();
1887 pOffsetText = m_xFootnoteOffsetLbl.get();
1888 pOffsetField = m_xFootnoteOffsetField.get();
1889 }
1890 else
1891 {
1892 pNtAtTextEndCB = m_xEndNtAtTextEndCB.get();
1893 pNtNumCB = m_xEndNtNumCB.get();
1894 pNtNumFormatCB = m_xEndNtNumFormatCB.get();
1895 pPrefixFT = m_xEndPrefixFT.get();
1896 pPrefixED = m_xEndPrefixED.get();
1897 pSuffixFT = m_xEndSuffixFT.get();
1898 pSuffixED = m_xEndSuffixED.get();
1899 pNumViewBox = m_xEndNumViewBox.get();
1900 pOffsetText = m_xEndOffsetLbl.get();
1901 pOffsetField = m_xEndOffsetField.get();
1902 }
1903
1904 const sal_uInt16 eState = rAttr.GetValue();
1905 switch( eState )
1906 {
1908 pNtNumFormatCB->set_state( TRISTATE_TRUE );
1909 [[fallthrough]];
1910
1912 pNtNumCB->set_state( TRISTATE_TRUE );
1913 [[fallthrough]];
1914
1915 case FTNEND_ATTXTEND:
1916 pNtAtTextEndCB->set_state( TRISTATE_TRUE );
1917 // no break;
1918 }
1919
1920 pNumViewBox->SelectNumberingType( rAttr.GetNumType() );
1921 pOffsetField->set_value( rAttr.GetOffset() + 1 );
1922 pPrefixED->set_text( rAttr.GetPrefix().replaceAll("\t", "\\t") );
1923 pSuffixED->set_text( rAttr.GetSuffix().replaceAll("\t", "\\t") );
1924
1925 switch( eState )
1926 {
1928 pNtNumCB->set_sensitive( false );
1929 [[fallthrough]];
1930
1931 case FTNEND_ATTXTEND:
1932 pNtNumFormatCB->set_sensitive( false );
1933 pOffsetField->set_sensitive( false );
1934 pOffsetText->set_sensitive( false );
1935 [[fallthrough]];
1936
1938 pNumViewBox->set_sensitive( false );
1939 pPrefixFT->set_sensitive( false );
1940 pPrefixED->set_sensitive( false );
1941 pSuffixFT->set_sensitive( false );
1942 pSuffixED->set_sensitive( false );
1943 // no break;
1944 }
1945}
1946
1948{
1949 ResetState( true, rSet->Get( RES_FTN_AT_TXTEND, false ));
1950 ResetState( false, rSet->Get( RES_END_AT_TXTEND, false ));
1951}
1952
1953std::unique_ptr<SfxTabPage> SwSectionFootnoteEndTabPage::Create( weld::Container* pPage, weld::DialogController* pController,
1954 const SfxItemSet* rAttrSet)
1955{
1956 return std::make_unique<SwSectionFootnoteEndTabPage>(pPage, pController, *rAttrSet);
1957}
1958
1960{
1961 bool bFoot = m_xFootnoteNtAtTextEndCB.get() == &rBox || m_xFootnoteNtNumCB.get() == &rBox ||
1962 m_xFootnoteNtNumFormatCB.get() == &rBox ;
1963
1964 weld::CheckButton *pNumBox, *pNumFormatBox, *pEndBox;
1965 SwNumberingTypeListBox* pNumViewBox;
1966 weld::Label *pOffsetText;
1967 weld::SpinButton *pOffsetField;
1968 weld::Label *pPrefixFT, *pSuffixFT;
1969 weld::Entry *pPrefixED, *pSuffixED;
1970
1971 if( bFoot )
1972 {
1973 pEndBox = m_xFootnoteNtAtTextEndCB.get();
1974 pNumBox = m_xFootnoteNtNumCB.get();
1975 pNumFormatBox = m_xFootnoteNtNumFormatCB.get();
1976 pNumViewBox = m_xFootnoteNumViewBox.get();
1977 pOffsetText = m_xFootnoteOffsetLbl.get();
1978 pOffsetField = m_xFootnoteOffsetField.get();
1979 pPrefixFT = m_xFootnotePrefixFT.get();
1980 pSuffixFT = m_xFootnoteSuffixFT.get();
1981 pPrefixED = m_xFootnotePrefixED.get();
1982 pSuffixED = m_xFootnoteSuffixED.get();
1983 }
1984 else
1985 {
1986 pEndBox = m_xEndNtAtTextEndCB.get();
1987 pNumBox = m_xEndNtNumCB.get();
1988 pNumFormatBox = m_xEndNtNumFormatCB.get();
1989 pNumViewBox = m_xEndNumViewBox.get();
1990 pOffsetText = m_xEndOffsetLbl.get();
1991 pOffsetField = m_xEndOffsetField.get();
1992 pPrefixFT = m_xEndPrefixFT.get();
1993 pSuffixFT = m_xEndSuffixFT.get();
1994 pPrefixED = m_xEndPrefixED.get();
1995 pSuffixED = m_xEndSuffixED.get();
1996 }
1997
1998 bool bEnableAtEnd = TRISTATE_TRUE == pEndBox->get_state();
1999 bool bEnableNum = bEnableAtEnd && TRISTATE_TRUE == pNumBox->get_state();
2000 bool bEnableNumFormat = bEnableNum && TRISTATE_TRUE == pNumFormatBox->get_state();
2001
2002 pNumBox->set_sensitive( bEnableAtEnd );
2003 pOffsetText->set_sensitive( bEnableNum );
2004 pOffsetField->set_sensitive( bEnableNum );
2005 pNumFormatBox->set_sensitive( bEnableNum );
2006 pNumViewBox->set_sensitive( bEnableNumFormat );
2007 pPrefixED->set_sensitive( bEnableNumFormat );
2008 pSuffixED->set_sensitive( bEnableNumFormat );
2009 pPrefixFT->set_sensitive( bEnableNumFormat );
2010 pSuffixFT->set_sensitive( bEnableNumFormat );
2011}
2012
2014 weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh)
2015 : SfxTabDialogController(pParent, "modules/swriter/ui/formatsectiondialog.ui",
2016 "FormatSectionDialog", &rSet)
2017 , m_rWrtSh(rSh)
2018{
2020 AddTabPage("columns", SwColumnPage::Create, nullptr);
2021 AddTabPage("background", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_BKG), nullptr);
2023 AddTabPage("indents", SwSectionIndentTabPage::Create, nullptr);
2024
2026 bool bWeb = dynamic_cast<SwWebDocShell*>( rSh.GetView().GetDocShell() ) != nullptr ;
2027 if(bWeb)
2028 {
2029 RemoveTabPage("notes");
2030 RemoveTabPage("indents");
2031 if( HTML_CFG_NS40 != nHtmlMode && HTML_CFG_WRITER != nHtmlMode)
2032 RemoveTabPage("columns");
2033 }
2034}
2035
2037{
2038}
2039
2041{
2042 if (rId == "background")
2043 {
2044 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
2045 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_SELECTOR)));
2046 rPage.PageCreated(aSet);
2047 }
2048 else if (rId == "columns")
2049 {
2050 static_cast<SwColumnPage&>(rPage).ShowBalance(true);
2051 static_cast<SwColumnPage&>(rPage).SetInSection(true);
2052 }
2053 else if (rId == "indents")
2054 static_cast<SwSectionIndentTabPage&>(rPage).SetWrtShell(m_rWrtSh);
2055}
2056
2058 : SfxTabPage(pPage, pController, "modules/swriter/ui/indentpage.ui", "IndentPage", &rAttrSet)
2059 , m_xBeforeMF(m_xBuilder->weld_metric_spin_button("before", FieldUnit::CM))
2060 , m_xAfterMF(m_xBuilder->weld_metric_spin_button("after", FieldUnit::CM))
2061 , m_xPreviewWin(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWin))
2062{
2064 m_xBeforeMF->connect_value_changed(aLk);
2065 m_xAfterMF->connect_value_changed(aLk);
2066}
2067
2069{
2070}
2071
2073{
2074 if (m_xBeforeMF->get_value_changed_from_saved() || m_xAfterMF->get_value_changed_from_saved())
2075 {
2076 SvxLRSpaceItem aLRSpace(
2077 m_xBeforeMF->denormalize(m_xBeforeMF->get_value(FieldUnit::TWIP)) ,
2078 m_xAfterMF->denormalize(m_xAfterMF->get_value(FieldUnit::TWIP)), 0, RES_LR_SPACE);
2079 rSet->Put(aLRSpace);
2080 }
2081 return true;
2082}
2083
2085{
2086 //this page doesn't show up in HTML mode
2087 FieldUnit aMetric = ::GetDfltMetric(false);
2088 SetFieldUnit(*m_xBeforeMF, aMetric);
2089 SetFieldUnit(*m_xAfterMF , aMetric);
2090
2091 SfxItemState eItemState = rSet->GetItemState( RES_LR_SPACE );
2092 if ( eItemState >= SfxItemState::DEFAULT )
2093 {
2094 const SvxLRSpaceItem& rSpace =
2095 rSet->Get( RES_LR_SPACE );
2096
2097 m_xBeforeMF->set_value(m_xBeforeMF->normalize(rSpace.GetLeft()), FieldUnit::TWIP);
2098 m_xAfterMF->set_value(m_xAfterMF->normalize(rSpace.GetRight()), FieldUnit::TWIP);
2099 }
2100 else
2101 {
2102 m_xBeforeMF->set_text("");
2103 m_xAfterMF->set_text("");
2104 }
2105 m_xBeforeMF->save_value();
2106 m_xAfterMF->save_value();
2107 IndentModifyHdl(*m_xBeforeMF);
2108}
2109
2110std::unique_ptr<SfxTabPage> SwSectionIndentTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet)
2111{
2112 return std::make_unique<SwSectionIndentTabPage>(pPage, pController, *rAttrSet);
2113}
2114
2116{
2117 //set sensible values at the preview
2118 m_aPreviewWin.SetAdjust(SvxAdjust::Block);
2119 m_aPreviewWin.SetLastLine(SvxAdjust::Block);
2120 const SwRect& rPageRect = rSh.GetAnyCurRect( CurRectType::Page );
2121 Size aPageSize(rPageRect.Width(), rPageRect.Height());
2122 m_aPreviewWin.SetSize(aPageSize);
2123}
2124
2126{
2127 m_aPreviewWin.SetLeftMargin(m_xBeforeMF->denormalize(m_xBeforeMF->get_value(FieldUnit::TWIP)));
2128 m_aPreviewWin.SetRightMargin(m_xAfterMF->denormalize(m_xAfterMF->get_value(FieldUnit::TWIP)));
2129 m_aPreviewWin.Invalidate();
2130}
2131
2132/* 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 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:547
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::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:466
SwWrtShell & m_rSh
Definition: regionsw.hxx:50
size_t FindArrPos(const SwSectionFormat *pFormat)
Definition: uiregionsw.cxx:536
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:420
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:559
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: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
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:358
void GetChildSections(SwSections &rArr, SectionSort eSort=SectionSort::Not, bool bAllSections=true) const
Definition: section.cxx:861
bool IsInNodesArr() const
Definition: section.cxx:893
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:181
const OUString & GetSectionName() const
Definition: section.hxx:171
SwSectionFormat * GetFormat()
Definition: section.hxx:339
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:2813
SwDocShell * GetDocShell()
Definition: view.cxx:1163
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:298
#define FN_PARAM_REGION_PROTECT
Definition: cmdid.h:810
#define FN_PARAM_REGION_NAME
Definition: cmdid.h:807
#define FN_PARAM_REGION_CONDITION
Definition: cmdid.h:808
#define FN_PARAM_REGION_EDIT_IN_READONLY
Definition: cmdid.h:811
#define FN_PARAM_REGION_HIDDEN
Definition: cmdid.h:809
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(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
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:168
sal_uInt16 sal_Unicode
IMPL_LINK(SwEditRegionDlg, GetFirstEntryHdl, weld::TreeView &, rBox, void)
Definition: uiregionsw.cxx:581
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:742
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: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)