summaryrefslogtreecommitdiff
path: root/sw/source/ui/misc
diff options
context:
space:
mode:
authorBernhard Widl <bernhard.widl@cib.de>2017-11-15 19:30:28 +0100
committerMichael Stahl <Michael.Stahl@cib.de>2018-07-06 10:21:48 +0200
commit7a586a9c6bf28088c72f163d724d1cb3259e7920 (patch)
tree2678e802b147c3f3e9663ee6b6bc7e82410600d9 /sw/source/ui/misc
parentd3e8be155c4483642b71b00f44cb057beb68f70f (diff)
tdf#101856 create bookmarks w/ new hidden/cond attrs, save as odt
Committer's note: this is forward ported from 5.2+backports branch, with numerous conflicts. tdf#101856 add new checkbox/editfield for hidden/condition attrs Conflicts: sw/uiconfig/swriter/ui/insertbookmark.ui Author: Bernhard Widl <bernhard.widl@cib.de> (cherry picked from commit c347e00821791377731ab32acd103ea006f3cc1b) tdf#101856 Fix crash in Insert Bookmark dialog Author: Serge Krot <Serge.Krot@cib.de> Reviewed-on: https://gerrit.libreoffice.org/50616 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit bcc16920eec647f2a3753d60c4d969862f272942) Change-Id: Ib1df7a4c1477693aa2d0ec067635cdcbd393cebd Reviewed-on: https://gerrit.libreoffice.org/46820 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'sw/source/ui/misc')
-rw-r--r--sw/source/ui/misc/bookmark.cxx37
1 files changed, 30 insertions, 7 deletions
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index 1b9395d4c1f7..f2eb26d68384 100644
--- a/sw/source/ui/misc/bookmark.cxx
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -209,7 +209,7 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, RenameHdl, Button*, void)
IMPL_LINK_NOARG(SwInsertBookmarkDlg, InsertHdl, Button*, void)
{
OUString sBookmark = m_pEditBox->GetText();
- rSh.SetBookmark(vcl::KeyCode(), sBookmark);
+ rSh.SetBookmark2(vcl::KeyCode(), sBookmark, m_pHideCB->IsChecked(), m_pConditionED->GetText());
rReq.AppendItem(SfxStringItem(FN_INSERT_BOOKMARK, sBookmark));
rReq.Done();
if (!rReq.IsDone())
@@ -218,6 +218,13 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, InsertHdl, Button*, void)
EndDialog(RET_OK);
}
+IMPL_LINK(SwInsertBookmarkDlg, ChangeHideHdl, Button *, pBox, void)
+{
+ bool bHide = static_cast<CheckBox*>(pBox)->IsChecked();
+ m_pConditionED->Enable(bHide);
+ m_pConditionFT->Enable(bHide);
+}
+
void SwInsertBookmarkDlg::GotoSelectedBookmark()
{
if (!ValidateBookmarks())
@@ -303,6 +310,9 @@ SwInsertBookmarkDlg::SwInsertBookmarkDlg(vcl::Window* pParent, SwWrtShell& rS, S
get(m_pDeleteBtn, "delete");
get(m_pGotoBtn, "goto");
get(m_pRenameBtn, "rename");
+ get(m_pHideCB, "hide");
+ get(m_pConditionFT, "condlabel");
+ get(m_pConditionED, "withcond");
m_pBookmarksBox = VclPtr<BookmarkTable>::Create(*m_pBookmarksContainer);
@@ -314,6 +324,7 @@ SwInsertBookmarkDlg::SwInsertBookmarkDlg(vcl::Window* pParent, SwWrtShell& rS, S
m_pDeleteBtn->SetClickHdl(LINK(this, SwInsertBookmarkDlg, DeleteHdl));
m_pGotoBtn->SetClickHdl(LINK(this, SwInsertBookmarkDlg, GotoHdl));
m_pRenameBtn->SetClickHdl(LINK(this, SwInsertBookmarkDlg, RenameHdl));
+ m_pHideCB->SetClickHdl(LINK(this, SwInsertBookmarkDlg, ChangeHideHdl));
m_pDeleteBtn->Disable();
m_pGotoBtn->Disable();
@@ -341,35 +352,43 @@ void SwInsertBookmarkDlg::dispose()
m_pGotoBtn.clear();
m_pEditBox.clear();
m_pRenameBtn.clear();
+ m_pHideCB.clear();
+ m_pConditionFT.clear();
+ m_pConditionED.clear();
SvxStandardDialog::dispose();
}
BookmarkTable::BookmarkTable(SvSimpleTableContainer& rParent) :
SvSimpleTable(rParent, 0)
{
- static long nTabs[] = {0, 40, 150};
+ static long nTabs[] = { 0, 40, 150, 300, 340 };
SetTabs(SAL_N_ELEMENTS(nTabs), nTabs, MapUnit::MapPixel);
SetSelectionMode(SelectionMode::Multiple);
InsertHeaderEntry(SwResId(STR_PAGE));
InsertHeaderEntry(SwResId(STR_BOOKMARK_NAME));
InsertHeaderEntry(SwResId(STR_BOOKMARK_TEXT));
+ InsertHeaderEntry(SwResId(STR_BOOKMARK_HIDDEN));
+ InsertHeaderEntry(SwResId(STR_BOOKMARK_CONDITION));
rParent.SetTable(this);
}
void BookmarkTable::InsertBookmark(sw::mark::IMark* pMark)
{
- OUString sBookmarkNodeText = pMark->GetMarkStart().nNode.GetNode().GetTextNode()->GetText();
- sal_Int32 nBookmarkNodeTextPos = pMark->GetMarkStart().nContent.GetIndex();
+ sw::mark::IBookmark* pBookmark = dynamic_cast<sw::mark::IBookmark*>(pMark);
+ assert(pBookmark);
+
+ OUString sBookmarkNodeText = pBookmark->GetMarkStart().nNode.GetNode().GetTextNode()->GetText();
+ sal_Int32 nBookmarkNodeTextPos = pBookmark->GetMarkStart().nContent.GetIndex();
sal_Int32 nBookmarkTextLen = 0;
bool bPulledAll = false;
bool bPulling = false;
static const sal_Int32 nMaxTextLen = 50;
- if (pMark->IsExpanded())
+ if (pBookmark->IsExpanded())
{
- nBookmarkTextLen = pMark->GetMarkEnd().nContent.GetIndex() - nBookmarkNodeTextPos;
+ nBookmarkTextLen = pBookmark->GetMarkEnd().nContent.GetIndex() - nBookmarkNodeTextPos;
}
else
{
@@ -390,8 +409,12 @@ void BookmarkTable::InsertBookmark(sw::mark::IMark* pMark)
else if (bPulling && !bPulledAll)
sBookmarkNodeText = "..." + sBookmarkNodeText;
+ OUString sHidden = "No";
+ if (pBookmark->IsHidden())
+ sHidden = "Yes";
+ OUString sHideCondition = pBookmark->GetHideCondition();
OUString sPageNum = OUString::number(SwPaM(pMark->GetMarkStart()).GetPageNum());
- OUString sColumnData = sPageNum + "\t" + pMark->GetName() + "\t" + sBookmarkNodeText;
+ OUString sColumnData = sPageNum + "\t" + pBookmark->GetName() + "\t" + sBookmarkNodeText + "\t" + sHidden + "\t" + sHideCondition;
InsertEntryToColumn(sColumnData, TREELIST_APPEND, 0xffff, pMark);
}