Kaydet (Commit) cb3e2a88 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SdTPAction

Change-Id: I3c72b19f9c5343451164b5bd35dc79a3753e6a37
Reviewed-on: https://gerrit.libreoffice.org/69179
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 0a909400
...@@ -1413,6 +1413,7 @@ SdPageObjsTLV::SdPageObjsTLV(std::unique_ptr<weld::TreeView> xTreeView) ...@@ -1413,6 +1413,7 @@ SdPageObjsTLV::SdPageObjsTLV(std::unique_ptr<weld::TreeView> xTreeView)
, m_pMedium(nullptr) , m_pMedium(nullptr)
, m_pOwnMedium(nullptr) , m_pOwnMedium(nullptr)
, m_bLinkableSelected(false) , m_bLinkableSelected(false)
, m_bShowAllPages(false)
{ {
m_xTreeView->connect_expanding(LINK(this, SdPageObjsTLV, RequestingChildrenHdl)); m_xTreeView->connect_expanding(LINK(this, SdPageObjsTLV, RequestingChildrenHdl));
m_xTreeView->connect_changed(LINK(this, SdPageObjsTLV, SelectHdl)); m_xTreeView->connect_changed(LINK(this, SdPageObjsTLV, SelectHdl));
...@@ -1610,6 +1611,157 @@ void SdPageObjsTLV::CloseBookmarkDoc() ...@@ -1610,6 +1611,157 @@ void SdPageObjsTLV::CloseBookmarkDoc()
m_pBookmarkDoc = nullptr; m_pBookmarkDoc = nullptr;
} }
bool SdPageObjsTLV::PageBelongsToCurrentShow(const SdPage* pPage) const
{
// Return <TRUE/> as default when there is no custom show or when none
// is used. The page does then belong to the standard show.
bool bBelongsToShow = true;
if (m_pDoc->getPresentationSettings().mbCustomShow)
{
// Get the current custom show.
SdCustomShow* pCustomShow = nullptr;
SdCustomShowList* pShowList = const_cast<SdDrawDocument*>(m_pDoc)->GetCustomShowList();
if (pShowList != nullptr)
{
sal_uLong nCurrentShowIndex = pShowList->GetCurPos();
pCustomShow = (*pShowList)[nCurrentShowIndex].get();
}
// Check whether the given page is part of that custom show.
if (pCustomShow != nullptr)
{
bBelongsToShow = false;
size_t nPageCount = pCustomShow->PagesVector().size();
for (size_t i=0; i<nPageCount && !bBelongsToShow; i++)
if (pPage == pCustomShow->PagesVector()[i])
bBelongsToShow = true;
}
}
return bBelongsToShow;
}
void SdPageObjsTLV::AddShapeList (
const SdrObjList& rList,
SdrObject* pShape,
const OUString& rsName,
const bool bIsExcluded,
weld::TreeIter* pParentEntry)
{
OUString aIcon(BMP_PAGE);
if (bIsExcluded)
aIcon = BMP_PAGE_EXCLUDED;
else if (pShape != nullptr)
aIcon = BMP_GROUP;
OUString aUserData("1");
if (pShape != nullptr)
aUserData = OUString::number(reinterpret_cast<sal_Int64>(pShape));
std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->make_iterator();
InsertEntry(pParentEntry, aUserData, rsName, aIcon, xEntry.get());
SdrObjListIter aIter(
&rList,
!rList.HasObjectNavigationOrder() /* use navigation order, if available */,
SdrIterMode::Flat);
while( aIter.IsMore() )
{
SdrObject* pObj = aIter.Next();
OSL_ASSERT(pObj!=nullptr);
// Get the shape name.
OUString aStr (GetObjectName( pObj ) );
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pObj)));
if( !aStr.isEmpty() )
{
if( pObj->GetObjInventor() == SdrInventor::Default && pObj->GetObjIdentifier() == OBJ_OLE2 )
{
InsertEntry(xEntry.get(), sId, aStr, BMP_OLE);
}
else if( pObj->GetObjInventor() == SdrInventor::Default && pObj->GetObjIdentifier() == OBJ_GRAF )
{
InsertEntry(xEntry.get(), sId, aStr, BMP_GRAPHIC);
}
else if (pObj->IsGroupObject())
{
AddShapeList(
*pObj->GetSubList(),
pObj,
aStr,
false,
xEntry.get());
}
else
{
InsertEntry(xEntry.get(), sId, aStr, BMP_OBJECTS);
}
}
}
if (!m_xTreeView->iter_has_child(*xEntry))
return;
if (bIsExcluded)
m_xTreeView->set_image(*xEntry, BMP_PAGEOBJS_EXCLUDED);
else
m_xTreeView->set_image(*xEntry, BMP_PAGEOBJS);
m_xTreeView->expand_row(*xEntry);
}
/**
* Fill TreeLB with pages and objects
*/
void SdPageObjsTLV::Fill(const SdDrawDocument* pInDoc, bool bAllPages, const OUString& rDocName)
{
OUString aSelection = m_xTreeView->get_selected_text();
clear();
m_pDoc = pInDoc;
m_aDocName = rDocName;
m_bShowAllPages = bAllPages;
m_pMedium = nullptr;
// first insert all pages including objects
sal_uInt16 nPage = 0;
const sal_uInt16 nMaxPages = m_pDoc->GetPageCount();
while( nPage < nMaxPages )
{
const SdPage* pPage = static_cast<const SdPage*>( m_pDoc->GetPage( nPage ) );
if( (m_bShowAllPages || pPage->GetPageKind() == PageKind::Standard)
&& (pPage->GetPageKind() != PageKind::Handout) ) //#94954# never list the normal handout page ( handout-masterpage is used instead )
{
bool bPageExluded = pPage->IsExcluded();
bool bPageBelongsToShow = PageBelongsToCurrentShow (pPage);
bPageExluded |= !bPageBelongsToShow;
AddShapeList(*pPage, nullptr, pPage->GetName(), bPageExluded, nullptr);
}
nPage++;
}
// then insert all master pages including objects
if( m_bShowAllPages )
{
nPage = 0;
const sal_uInt16 nMaxMasterPages = m_pDoc->GetMasterPageCount();
while( nPage < nMaxMasterPages )
{
const SdPage* pPage = static_cast<const SdPage*>( m_pDoc->GetMasterPage( nPage ) );
AddShapeList(*pPage, nullptr, pPage->GetName(), false, nullptr);
nPage++;
}
}
if (!aSelection.isEmpty())
m_xTreeView->select_text(aSelection);
}
/** /**
* We insert only the first entry. Children are created on demand. * We insert only the first entry. Children are created on demand.
*/ */
...@@ -1629,13 +1781,45 @@ void SdPageObjsTLV::Fill( const SdDrawDocument* pInDoc, SfxMedium* pInMedium, ...@@ -1629,13 +1781,45 @@ void SdPageObjsTLV::Fill( const SdDrawDocument* pInDoc, SfxMedium* pInMedium,
m_xTreeView->insert(nullptr, -1, &m_aDocName, &sId, nullptr, nullptr, &sImgDoc, true, nullptr); m_xTreeView->insert(nullptr, -1, &m_aDocName, &sId, nullptr, nullptr, &sImgDoc, true, nullptr);
} }
/**
* select a entry in TreeLB
*/
bool SdPageObjsTLV::SelectEntry( const OUString& rName )
{
bool bFound = false;
if (!rName.isEmpty())
{
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
OUString aTmp;
if (m_xTreeView->get_iter_first(*xEntry))
{
do
{
aTmp = m_xTreeView->get_text(*xEntry);
if (aTmp == rName)
{
m_xTreeView->set_cursor(*xEntry);
m_xTreeView->select(*xEntry);
bFound = true;
break;
}
}
while (m_xTreeView->iter_next(*xEntry));
}
}
return bFound;
}
SdPageObjsTLV::~SdPageObjsTLV() SdPageObjsTLV::~SdPageObjsTLV()
{ {
if (m_pBookmarkDoc) if (m_pBookmarkDoc)
CloseBookmarkDoc(); CloseBookmarkDoc();
else else
{ {
// no document was created from mpMedium, so this object is still the owner of it // no document was created from m_pMedium, so this object is still the owner of it
delete m_pMedium; delete m_pMedium;
} }
m_xAccel.reset(); m_xAccel.reset();
......
This diff is collapsed.
...@@ -301,6 +301,9 @@ private: ...@@ -301,6 +301,9 @@ private:
SfxMedium* m_pMedium; SfxMedium* m_pMedium;
SfxMedium* m_pOwnMedium; SfxMedium* m_pOwnMedium;
bool m_bLinkableSelected; bool m_bLinkableSelected;
/** This flag controls whether to show all pages.
*/
bool m_bShowAllPages;
OUString m_aDocName; OUString m_aDocName;
::sd::DrawDocShellRef m_xBookmarkDocShRef; ///< for the loading of bookmarks ::sd::DrawDocShellRef m_xBookmarkDocShRef; ///< for the loading of bookmarks
Link<weld::TreeView&, void> m_aChangeHdl; Link<weld::TreeView&, void> m_aChangeHdl;
...@@ -321,11 +324,32 @@ private: ...@@ -321,11 +324,32 @@ private:
DECL_LINK(RequestingChildrenHdl, const weld::TreeIter&, bool); DECL_LINK(RequestingChildrenHdl, const weld::TreeIter&, bool);
DECL_LINK(SelectHdl, weld::TreeView&, void); DECL_LINK(SelectHdl, weld::TreeView&, void);
/** Determine whether the specified page belongs to the current show
which is either the standard show or a custom show.
@param pPage
Pointer to the page for which to check whether it belongs to the
show.
@return
Returns <FALSE/> if there is no custom show or if the current
show does not contain the specified page at least once.
*/
bool PageBelongsToCurrentShow (const SdPage* pPage) const;
public: public:
SdPageObjsTLV(std::unique_ptr<weld::TreeView> xTreeview); SdPageObjsTLV(std::unique_ptr<weld::TreeView> xTreeview);
~SdPageObjsTLV(); ~SdPageObjsTLV();
void hide()
{
m_xTreeView->hide();
}
void show()
{
m_xTreeView->show();
}
void set_size_request(int nWidth, int nHeight) void set_size_request(int nWidth, int nHeight)
{ {
m_xTreeView->set_size_request(nWidth, nHeight); m_xTreeView->set_size_request(nWidth, nHeight);
...@@ -346,9 +370,16 @@ public: ...@@ -346,9 +370,16 @@ public:
m_xTreeView->set_selection_mode(eMode); m_xTreeView->set_selection_mode(eMode);
} }
std::vector<int> get_selected_rows() const bool SelectEntry(const OUString& rName);
OUString get_selected_text() const
{ {
return m_xTreeView->get_selected_rows(); return m_xTreeView->get_selected_text();
}
bool get_selected() const
{
return m_xTreeView->get_selected(nullptr);
} }
void connect_changed(const Link<weld::TreeView&, void>& rLink) void connect_changed(const Link<weld::TreeView&, void>& rLink)
...@@ -371,10 +402,41 @@ public: ...@@ -371,10 +402,41 @@ public:
return m_xTreeView->make_iterator(); return m_xTreeView->make_iterator();
} }
bool get_visible() const
{
return m_xTreeView->get_visible();
}
void unselect_all()
{
m_xTreeView->unselect_all();
}
void SetViewFrame(const SfxViewFrame* pViewFrame); void SetViewFrame(const SfxViewFrame* pViewFrame);
void Fill(const SdDrawDocument*, bool bAllPages, const OUString& rDocName);
void Fill(const SdDrawDocument*, SfxMedium* pSfxMedium, const OUString& rDocName); void Fill(const SdDrawDocument*, SfxMedium* pSfxMedium, const OUString& rDocName);
/** Add one list box entry for the parent of the given shapes and one child entry for
each of the given shapes.
@param rList
The container of shapes that are to be inserted.
@param pShape
The parent shape or NULL when the parent is a page.
@param rsName
The name to be displayed for the new parent node.
@param bIsExcluded
Some pages can be excluded (from the show?).
@param pParentEntry
The parent entry of the new parent entry.
*/
void AddShapeList (
const SdrObjList& rList,
SdrObject* pShape,
const OUString& rsName,
const bool bIsExcluded,
weld::TreeIter* pParentEntry);
/** return selected entries /** return selected entries
nDepth == 0 -> pages nDepth == 0 -> pages
nDepth == 1 -> objects */ nDepth == 1 -> objects */
...@@ -389,6 +451,16 @@ public: ...@@ -389,6 +451,16 @@ public:
{ {
m_xTreeView->insert(nullptr, -1, &rName, nullptr, nullptr, nullptr, &rExpander, false, nullptr); m_xTreeView->insert(nullptr, -1, &rName, nullptr, nullptr, nullptr, &rExpander, false, nullptr);
} }
void InsertEntry(weld::TreeIter* pParent, const OUString& rId, const OUString &rName, const OUString &rExpander, weld::TreeIter* pEntry = nullptr)
{
m_xTreeView->insert(pParent, -1, &rName, &rId, nullptr, nullptr, &rExpander, false, pEntry);
}
void clear()
{
m_xTreeView->clear();
}
}; };
#endif // INCLUDED_SD_SOURCE_UI_INC_SDTREELB_HXX #endif // INCLUDED_SD_SOURCE_UI_INC_SDTREELB_HXX
......
...@@ -51,22 +51,6 @@ public: ...@@ -51,22 +51,6 @@ public:
class SdTPAction : public SfxTabPage class SdTPAction : public SfxTabPage
{ {
private: private:
VclPtr<ListBox> m_pLbAction;
VclPtr<FixedText> m_pFtTree; // jump destination controls
VclPtr<SdPageObjsTLB> m_pLbTree;
VclPtr<SdPageObjsTLB> m_pLbTreeDocument;
VclPtr<ListBox> m_pLbOLEAction;
VclPtr<VclFrame> m_pFrame;
VclPtr<Edit> m_pEdtSound;
VclPtr<Edit> m_pEdtBookmark;
VclPtr<Edit> m_pEdtDocument;
VclPtr<Edit> m_pEdtProgram;
VclPtr<Edit> m_pEdtMacro;
VclPtr<PushButton> m_pBtnSearch;
VclPtr<PushButton> m_pBtnSeek;
const ::sd::View* mpView; const ::sd::View* mpView;
SdDrawDocument* mpDoc; SdDrawDocument* mpDoc;
XColorListRef pColList; XColorListRef pColList;
...@@ -76,10 +60,24 @@ private: ...@@ -76,10 +60,24 @@ private:
OUString aLastFile; OUString aLastFile;
::std::vector< long > aVerbVector; ::std::vector< long > aVerbVector;
DECL_LINK( ClickSearchHdl, Button*, void ); std::unique_ptr<weld::ComboBox> m_xLbAction;
DECL_LINK( ClickActionHdl, ListBox&, void ); std::unique_ptr<weld::Label> m_xFtTree; // jump destination controls
DECL_LINK( SelectTreeHdl, SvTreeListBox*, void ); std::unique_ptr<SdPageObjsTLV> m_xLbTree;
DECL_LINK( CheckFileHdl, Control&, void ); std::unique_ptr<SdPageObjsTLV> m_xLbTreeDocument;
std::unique_ptr<weld::TreeView> m_xLbOLEAction;
std::unique_ptr<weld::Frame> m_xFrame;
std::unique_ptr<weld::Entry> m_xEdtSound;
std::unique_ptr<weld::Entry> m_xEdtBookmark;
std::unique_ptr<weld::Entry> m_xEdtDocument;
std::unique_ptr<weld::Entry> m_xEdtProgram;
std::unique_ptr<weld::Entry> m_xEdtMacro;
std::unique_ptr<weld::Button> m_xBtnSearch;
std::unique_ptr<weld::Button> m_xBtnSeek;
DECL_LINK( ClickSearchHdl, weld::Button&, void );
DECL_LINK( ClickActionHdl, weld::ComboBox&, void );
DECL_LINK( SelectTreeHdl, weld::TreeView&, void );
DECL_LINK( CheckFileHdl, weld::Widget&, void );
void UpdateTree(); void UpdateTree();
void OpenFileDialog(); void OpenFileDialog();
...@@ -90,9 +88,8 @@ private: ...@@ -90,9 +88,8 @@ private:
static const char* GetClickActionSdResId(css::presentation::ClickAction eCA); static const char* GetClickActionSdResId(css::presentation::ClickAction eCA);
public: public:
SdTPAction( vcl::Window* pParent, const SfxItemSet& rInAttrs ); SdTPAction(TabPageParent pParent, const SfxItemSet& rInAttrs);
virtual ~SdTPAction() override; virtual ~SdTPAction() override;
virtual void dispose() override;
static VclPtr<SfxTabPage> Create( TabPageParent, const SfxItemSet& ); static VclPtr<SfxTabPage> Create( TabPageParent, const SfxItemSet& );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment